Mercurial > repos > IBBoard.WarFoundry.GUI.WinForms
annotate FrmUnit.cs @ 94:e4a8653b9536
Re #196: Add notes and abilities to UI
* Add unit type's notes to Unit form
* Translate label
author | IBBoard <dev@ibboard.co.uk> |
---|---|
date | Mon, 09 Nov 2009 12:42:13 +0000 |
parents | 0bb9f40d44eb |
children | 83c259516041 |
rev | line source |
---|---|
36 | 1 // This file (FrmUnit.cs) is a part of the IBBoard.WarFoundry.GUI.WinForms project and is copyright 2007, 2008, 2009 IBBoard. |
27
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
2 // |
36 | 3 // 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. |
27
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
4 |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
5 using System; |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
6 using System.Drawing; |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
7 using System.Data; |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
8 using System.Collections.Generic; |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
9 using System.ComponentModel; |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
10 using System.Windows.Forms; |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
11 using IBBoard.Commands; |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
12 using IBBoard.Lang; |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
13 using IBBoard.Windows.Forms; |
85
0bb9f40d44eb
Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents:
84
diff
changeset
|
14 using IBBoard.Windows.Forms.I18N; |
27
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
15 using IBBoard.WarFoundry.API; |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
16 using IBBoard.WarFoundry.API.Commands; |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
17 using IBBoard.WarFoundry.API.Objects; |
40
740350673006
Re #117: Add percentage and number boxes to equipment item dialogs
IBBoard <dev@ibboard.co.uk>
parents:
36
diff
changeset
|
18 using IBBoard.WarFoundry.GUI.WinForms.UI; |
27
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
19 using IBBoard.WarFoundry.GUI.WinForms.Util; |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
20 |
40
740350673006
Re #117: Add percentage and number boxes to equipment item dialogs
IBBoard <dev@ibboard.co.uk>
parents:
36
diff
changeset
|
21 namespace IBBoard.WarFoundry.GUI.WinForms |
27
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
22 { |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
23 /// <summary> |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
24 /// Summary description for FrmUnit. |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
25 /// </summary> |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
26 public class FrmUnit : IBBoard.Windows.Forms.IBBForm |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
27 { |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
28 private Unit unit; |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
29 private Dictionary<UnitEquipmentItem, UnitEquipmentChoice> equipmentChoices = new Dictionary<UnitEquipmentItem, UnitEquipmentChoice>(); |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
30 private CommandStack commandStack; |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
31 private System.Windows.Forms.DataGrid statsGrid; |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
32 private System.Windows.Forms.TextBox tbUnitName; |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
33 private System.Windows.Forms.NumericUpDown unitSize; |
85
0bb9f40d44eb
Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents:
84
diff
changeset
|
34 private IBBLabel lblUnitSize; |
0bb9f40d44eb
Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents:
84
diff
changeset
|
35 private IBBButton bttnAddWeapon; |
0bb9f40d44eb
Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents:
84
diff
changeset
|
36 private IBBButton bttnRemoveWeapon; |
0bb9f40d44eb
Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents:
84
diff
changeset
|
37 private IBBLabel lblEquip; |
60
c283545d2d0b
Re #168: Combine "required" and "optional" equipment boxes
IBBoard <dev@ibboard.co.uk>
parents:
55
diff
changeset
|
38 private System.Windows.Forms.ListBox equipmentList; |
85
0bb9f40d44eb
Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents:
84
diff
changeset
|
39 private IBBButton bttnReplaceWeapon; |
0bb9f40d44eb
Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents:
84
diff
changeset
|
40 private IBBButton bttnEditWeapon; |
53
e6d0d9eababf
Fixes #163: Show unit cost on unit dialog
IBBoard <dev@ibboard.co.uk>
parents:
52
diff
changeset
|
41 private Label lblPoints; |
94
e4a8653b9536
Re #196: Add notes and abilities to UI
IBBoard <dev@ibboard.co.uk>
parents:
85
diff
changeset
|
42 private IBBLabel lblNotes; |
e4a8653b9536
Re #196: Add notes and abilities to UI
IBBoard <dev@ibboard.co.uk>
parents:
85
diff
changeset
|
43 private TextBox notes; |
27
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
44 /// <summary> |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
45 /// Required designer variable. |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
46 /// </summary> |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
47 private System.ComponentModel.Container components = null; |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
48 |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
49 public FrmUnit(Unit toDisplay, CommandStack cmdStack) |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
50 { |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
51 unit = toDisplay; |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
52 commandStack = cmdStack; |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
53 // |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
54 // Required for Windows Form Designer support |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
55 // |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
56 InitializeComponent(); |
85
0bb9f40d44eb
Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents:
84
diff
changeset
|
57 ControlTranslator.TranslateControl(this); |
0bb9f40d44eb
Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents:
84
diff
changeset
|
58 Text = Translation.GetTranslation("FrmUnit", "{0}", unit.Name); |
27
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
59 unit.NameChanged += new StringValChangedDelegate(unit_NameChanged); |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
60 unit.UnitSizeChanged += new IntValChangedDelegate(unit_UnitSizeChanged); |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
61 unit.UnitEquipmentAmountChanged += new DoubleValChangedDelegate(unit_UnitEquipmentAmountChanged); |
53
e6d0d9eababf
Fixes #163: Show unit cost on unit dialog
IBBoard <dev@ibboard.co.uk>
parents:
52
diff
changeset
|
62 unit.PointsValueChanged += new DoubleValChangedDelegate(unit_PointsValueChanged); |
27
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
63 |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
64 if (unit.UnitType.MaxSize == unit.UnitType.MinSize) |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
65 { |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
66 unitSize.Value = unit.UnitType.MaxSize; |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
67 unitSize.Visible = false; |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
68 lblUnitSize.Visible = false; |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
69 } |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
70 else |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
71 { |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
72 unitSize.Value = unit.Size; |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
73 unitSize.Maximum = (unit.UnitType.MaxSize == WarFoundryCore.INFINITY ? int.MaxValue : unit.UnitType.MaxSize); |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
74 unitSize.Minimum = unit.UnitType.MinSize; |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
75 } |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
76 |
94
e4a8653b9536
Re #196: Add notes and abilities to UI
IBBoard <dev@ibboard.co.uk>
parents:
85
diff
changeset
|
77 notes.Text = unit.UnitType.Notes; |
53
e6d0d9eababf
Fixes #163: Show unit cost on unit dialog
IBBoard <dev@ibboard.co.uk>
parents:
52
diff
changeset
|
78 SetPointsValueText(); |
27
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
79 SetStats(); |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
80 SetWeapons(); |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
81 } |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
82 |
53
e6d0d9eababf
Fixes #163: Show unit cost on unit dialog
IBBoard <dev@ibboard.co.uk>
parents:
52
diff
changeset
|
83 void unit_PointsValueChanged(WarFoundryObject obj, double oldValue, double newValue) |
e6d0d9eababf
Fixes #163: Show unit cost on unit dialog
IBBoard <dev@ibboard.co.uk>
parents:
52
diff
changeset
|
84 { |
e6d0d9eababf
Fixes #163: Show unit cost on unit dialog
IBBoard <dev@ibboard.co.uk>
parents:
52
diff
changeset
|
85 SetPointsValueText(); |
e6d0d9eababf
Fixes #163: Show unit cost on unit dialog
IBBoard <dev@ibboard.co.uk>
parents:
52
diff
changeset
|
86 } |
e6d0d9eababf
Fixes #163: Show unit cost on unit dialog
IBBoard <dev@ibboard.co.uk>
parents:
52
diff
changeset
|
87 |
e6d0d9eababf
Fixes #163: Show unit cost on unit dialog
IBBoard <dev@ibboard.co.uk>
parents:
52
diff
changeset
|
88 private void SetPointsValueText() |
e6d0d9eababf
Fixes #163: Show unit cost on unit dialog
IBBoard <dev@ibboard.co.uk>
parents:
52
diff
changeset
|
89 { |
62
0e7c257ca8d6
Fixes #164: Show unit cost in army tree
IBBoard <dev@ibboard.co.uk>
parents:
60
diff
changeset
|
90 lblPoints.Text = "(" + unit.Points + " pts)"; |
53
e6d0d9eababf
Fixes #163: Show unit cost on unit dialog
IBBoard <dev@ibboard.co.uk>
parents:
52
diff
changeset
|
91 } |
e6d0d9eababf
Fixes #163: Show unit cost on unit dialog
IBBoard <dev@ibboard.co.uk>
parents:
52
diff
changeset
|
92 |
27
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
93 private void SetStats() |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
94 { |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
95 DataTable dt = new DataTable(); |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
96 Stat[] stats = unit.UnitStatsArrayWithName; |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
97 int statsCount = stats.Length; |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
98 DataColumn[] dc = new DataColumn[statsCount]; |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
99 |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
100 DataGridTableStyle dgStyle = new DataGridTableStyle(); |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
101 dgStyle.RowHeadersVisible = false; |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
102 |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
103 Stat stat = stats[0]; |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
104 DataColumn tempCol = new DataColumn(stat.ParentSlotName); |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
105 tempCol.DataType = stat.GetType(); |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
106 |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
107 for (int i = 0; i < statsCount; i++) |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
108 { |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
109 stat = stats[i]; |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
110 tempCol = new DataColumn(stat.ParentSlotName); |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
111 tempCol.DataType = stat.GetType(); |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
112 dc[i] = tempCol; |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
113 DataGridColumnStyle colStyle = new StatColumnStyle(); |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
114 colStyle.Width = 40; |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
115 colStyle.MappingName = stat.ParentSlotName; |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
116 colStyle.HeaderText = stat.ParentSlotName; |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
117 colStyle.Alignment = HorizontalAlignment.Center; |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
118 colStyle.ReadOnly = true; |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
119 dgStyle.GridColumnStyles.Add(colStyle); |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
120 } |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
121 |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
122 DataGridColumnStyle nameColStyle = dgStyle.GridColumnStyles[0]; |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
123 nameColStyle.HeaderText = Translation.GetTranslation("UnitName", "Name"); |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
124 nameColStyle.Alignment = HorizontalAlignment.Left; |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
125 nameColStyle.Width = statsGrid.ClientSize.Width - ((stats.Length - 1) * 40) - 4; |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
126 |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
127 dt.Columns.AddRange(dc); |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
128 |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
129 DataRow dr = dt.NewRow(); |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
130 dr.ItemArray = stats; |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
131 dt.Rows.Add(dr); |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
132 statsGrid.DataSource = dt; |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
133 statsGrid.TableStyles.Add(dgStyle); |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
134 } |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
135 |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
136 private void SetWeapons() |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
137 { |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
138 foreach (UnitEquipmentItem item in unit.GetEquipment()) |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
139 { |
60
c283545d2d0b
Re #168: Combine "required" and "optional" equipment boxes
IBBoard <dev@ibboard.co.uk>
parents:
55
diff
changeset
|
140 equipmentList.Items.Add(GetEquipmentChoice(item)); |
27
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
141 } |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
142 } |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
143 |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
144 private UnitEquipmentChoice GetEquipmentChoice(UnitEquipmentItem item) |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
145 { |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
146 UnitEquipmentChoice choice = null; |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
147 equipmentChoices.TryGetValue(item, out choice); |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
148 |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
149 if (choice == null) |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
150 { |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
151 choice = new UnitEquipmentChoice(Unit, item); |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
152 equipmentChoices[item] = choice; |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
153 } |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
154 |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
155 return choice; |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
156 } |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
157 |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
158 /// <summary> |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
159 /// Clean up any resources being used. |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
160 /// </summary> |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
161 protected override void Dispose(bool disposing) |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
162 { |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
163 //remove our leave events so that disposing doesn't trigger them |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
164 tbUnitName.Leave -= new System.EventHandler(this.tbUnitName_Leave); |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
165 unitSize.Leave -= new System.EventHandler(this.unitSize_Leave); |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
166 |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
167 if (disposing) |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
168 { |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
169 if (components != null) |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
170 { |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
171 components.Dispose(); |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
172 } |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
173 } |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
174 base.Dispose(disposing); |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
175 } |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
176 |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
177 #region Windows Form Designer generated code |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
178 /// <summary> |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
179 /// Required method for Designer support - do not modify |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
180 /// the contents of this method with the code editor. |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
181 /// </summary> |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
182 private void InitializeComponent() |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
183 { |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
184 this.statsGrid = new System.Windows.Forms.DataGrid(); |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
185 this.tbUnitName = new System.Windows.Forms.TextBox(); |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
186 this.unitSize = new System.Windows.Forms.NumericUpDown(); |
94
e4a8653b9536
Re #196: Add notes and abilities to UI
IBBoard <dev@ibboard.co.uk>
parents:
85
diff
changeset
|
187 this.lblUnitSize = new IBBoard.Windows.Forms.IBBLabel(); |
e4a8653b9536
Re #196: Add notes and abilities to UI
IBBoard <dev@ibboard.co.uk>
parents:
85
diff
changeset
|
188 this.lblEquip = new IBBoard.Windows.Forms.IBBLabel(); |
e4a8653b9536
Re #196: Add notes and abilities to UI
IBBoard <dev@ibboard.co.uk>
parents:
85
diff
changeset
|
189 this.bttnAddWeapon = new IBBoard.Windows.Forms.IBBButton(); |
e4a8653b9536
Re #196: Add notes and abilities to UI
IBBoard <dev@ibboard.co.uk>
parents:
85
diff
changeset
|
190 this.bttnRemoveWeapon = new IBBoard.Windows.Forms.IBBButton(); |
60
c283545d2d0b
Re #168: Combine "required" and "optional" equipment boxes
IBBoard <dev@ibboard.co.uk>
parents:
55
diff
changeset
|
191 this.equipmentList = new System.Windows.Forms.ListBox(); |
94
e4a8653b9536
Re #196: Add notes and abilities to UI
IBBoard <dev@ibboard.co.uk>
parents:
85
diff
changeset
|
192 this.bttnReplaceWeapon = new IBBoard.Windows.Forms.IBBButton(); |
e4a8653b9536
Re #196: Add notes and abilities to UI
IBBoard <dev@ibboard.co.uk>
parents:
85
diff
changeset
|
193 this.bttnEditWeapon = new IBBoard.Windows.Forms.IBBButton(); |
53
e6d0d9eababf
Fixes #163: Show unit cost on unit dialog
IBBoard <dev@ibboard.co.uk>
parents:
52
diff
changeset
|
194 this.lblPoints = new System.Windows.Forms.Label(); |
94
e4a8653b9536
Re #196: Add notes and abilities to UI
IBBoard <dev@ibboard.co.uk>
parents:
85
diff
changeset
|
195 this.lblNotes = new IBBoard.Windows.Forms.IBBLabel(); |
e4a8653b9536
Re #196: Add notes and abilities to UI
IBBoard <dev@ibboard.co.uk>
parents:
85
diff
changeset
|
196 this.notes = new System.Windows.Forms.TextBox(); |
55
346b4ac34997
Re #163: Unit cost on unit dialog
IBBoard <dev@ibboard.co.uk>
parents:
53
diff
changeset
|
197 ((System.ComponentModel.ISupportInitialize) (this.statsGrid)).BeginInit(); |
346b4ac34997
Re #163: Unit cost on unit dialog
IBBoard <dev@ibboard.co.uk>
parents:
53
diff
changeset
|
198 ((System.ComponentModel.ISupportInitialize) (this.unitSize)).BeginInit(); |
27
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
199 this.SuspendLayout(); |
51
53a18feb2370
* Set anchoring for better handling of resizing dialog
IBBoard <dev@ibboard.co.uk>
parents:
40
diff
changeset
|
200 // |
27
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
201 // statsGrid |
51
53a18feb2370
* Set anchoring for better handling of resizing dialog
IBBoard <dev@ibboard.co.uk>
parents:
40
diff
changeset
|
202 // |
27
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
203 this.statsGrid.AllowNavigation = false; |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
204 this.statsGrid.AllowSorting = false; |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
205 this.statsGrid.AlternatingBackColor = System.Drawing.SystemColors.Control; |
55
346b4ac34997
Re #163: Unit cost on unit dialog
IBBoard <dev@ibboard.co.uk>
parents:
53
diff
changeset
|
206 this.statsGrid.Anchor = ((System.Windows.Forms.AnchorStyles) (((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) |
51
53a18feb2370
* Set anchoring for better handling of resizing dialog
IBBoard <dev@ibboard.co.uk>
parents:
40
diff
changeset
|
207 | System.Windows.Forms.AnchorStyles.Right))); |
27
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
208 this.statsGrid.BackgroundColor = System.Drawing.SystemColors.Control; |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
209 this.statsGrid.CaptionVisible = false; |
51
53a18feb2370
* Set anchoring for better handling of resizing dialog
IBBoard <dev@ibboard.co.uk>
parents:
40
diff
changeset
|
210 this.statsGrid.CausesValidation = false; |
27
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
211 this.statsGrid.DataMember = ""; |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
212 this.statsGrid.GridLineColor = System.Drawing.SystemColors.ControlDarkDark; |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
213 this.statsGrid.HeaderForeColor = System.Drawing.SystemColors.ControlText; |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
214 this.statsGrid.Location = new System.Drawing.Point(8, 32); |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
215 this.statsGrid.Name = "statsGrid"; |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
216 this.statsGrid.PreferredColumnWidth = 40; |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
217 this.statsGrid.ReadOnly = true; |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
218 this.statsGrid.RowHeadersVisible = false; |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
219 this.statsGrid.SelectionBackColor = System.Drawing.SystemColors.Control; |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
220 this.statsGrid.SelectionForeColor = System.Drawing.SystemColors.WindowText; |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
221 this.statsGrid.Size = new System.Drawing.Size(600, 88); |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
222 this.statsGrid.TabIndex = 0; |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
223 this.statsGrid.TabStop = false; |
51
53a18feb2370
* Set anchoring for better handling of resizing dialog
IBBoard <dev@ibboard.co.uk>
parents:
40
diff
changeset
|
224 // |
27
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
225 // tbUnitName |
51
53a18feb2370
* Set anchoring for better handling of resizing dialog
IBBoard <dev@ibboard.co.uk>
parents:
40
diff
changeset
|
226 // |
27
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
227 this.tbUnitName.Location = new System.Drawing.Point(8, 8); |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
228 this.tbUnitName.Name = "tbUnitName"; |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
229 this.tbUnitName.Size = new System.Drawing.Size(344, 20); |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
230 this.tbUnitName.TabIndex = 1; |
51
53a18feb2370
* Set anchoring for better handling of resizing dialog
IBBoard <dev@ibboard.co.uk>
parents:
40
diff
changeset
|
231 this.tbUnitName.Leave += new System.EventHandler(this.tbUnitName_Leave); |
27
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
232 this.tbUnitName.KeyDown += new System.Windows.Forms.KeyEventHandler(this.tbUnitName_KeyDown); |
51
53a18feb2370
* Set anchoring for better handling of resizing dialog
IBBoard <dev@ibboard.co.uk>
parents:
40
diff
changeset
|
233 // |
27
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
234 // unitSize |
51
53a18feb2370
* Set anchoring for better handling of resizing dialog
IBBoard <dev@ibboard.co.uk>
parents:
40
diff
changeset
|
235 // |
55
346b4ac34997
Re #163: Unit cost on unit dialog
IBBoard <dev@ibboard.co.uk>
parents:
53
diff
changeset
|
236 this.unitSize.Anchor = ((System.Windows.Forms.AnchorStyles) ((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); |
27
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
237 this.unitSize.Location = new System.Drawing.Point(528, 8); |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
238 this.unitSize.Name = "unitSize"; |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
239 this.unitSize.Size = new System.Drawing.Size(80, 20); |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
240 this.unitSize.TabIndex = 1; |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
241 this.unitSize.TextAlign = System.Windows.Forms.HorizontalAlignment.Right; |
51
53a18feb2370
* Set anchoring for better handling of resizing dialog
IBBoard <dev@ibboard.co.uk>
parents:
40
diff
changeset
|
242 this.unitSize.Value = new decimal(new int[] { |
53a18feb2370
* Set anchoring for better handling of resizing dialog
IBBoard <dev@ibboard.co.uk>
parents:
40
diff
changeset
|
243 1, |
53a18feb2370
* Set anchoring for better handling of resizing dialog
IBBoard <dev@ibboard.co.uk>
parents:
40
diff
changeset
|
244 0, |
53a18feb2370
* Set anchoring for better handling of resizing dialog
IBBoard <dev@ibboard.co.uk>
parents:
40
diff
changeset
|
245 0, |
53a18feb2370
* Set anchoring for better handling of resizing dialog
IBBoard <dev@ibboard.co.uk>
parents:
40
diff
changeset
|
246 0}); |
53a18feb2370
* Set anchoring for better handling of resizing dialog
IBBoard <dev@ibboard.co.uk>
parents:
40
diff
changeset
|
247 this.unitSize.Leave += new System.EventHandler(this.unitSize_Leave); |
27
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
248 this.unitSize.KeyDown += new System.Windows.Forms.KeyEventHandler(this.unitSize_KeyDown); |
51
53a18feb2370
* Set anchoring for better handling of resizing dialog
IBBoard <dev@ibboard.co.uk>
parents:
40
diff
changeset
|
249 // |
27
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
250 // lblUnitSize |
51
53a18feb2370
* Set anchoring for better handling of resizing dialog
IBBoard <dev@ibboard.co.uk>
parents:
40
diff
changeset
|
251 // |
55
346b4ac34997
Re #163: Unit cost on unit dialog
IBBoard <dev@ibboard.co.uk>
parents:
53
diff
changeset
|
252 this.lblUnitSize.Anchor = ((System.Windows.Forms.AnchorStyles) ((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); |
346b4ac34997
Re #163: Unit cost on unit dialog
IBBoard <dev@ibboard.co.uk>
parents:
53
diff
changeset
|
253 this.lblUnitSize.Location = new System.Drawing.Point(452, 8); |
27
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
254 this.lblUnitSize.Name = "lblUnitSize"; |
55
346b4ac34997
Re #163: Unit cost on unit dialog
IBBoard <dev@ibboard.co.uk>
parents:
53
diff
changeset
|
255 this.lblUnitSize.Size = new System.Drawing.Size(72, 23); |
27
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
256 this.lblUnitSize.TabIndex = 0; |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
257 this.lblUnitSize.Text = "unit size"; |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
258 this.lblUnitSize.TextAlign = System.Drawing.ContentAlignment.TopRight; |
51
53a18feb2370
* Set anchoring for better handling of resizing dialog
IBBoard <dev@ibboard.co.uk>
parents:
40
diff
changeset
|
259 // |
60
c283545d2d0b
Re #168: Combine "required" and "optional" equipment boxes
IBBoard <dev@ibboard.co.uk>
parents:
55
diff
changeset
|
260 // lblEquip |
51
53a18feb2370
* Set anchoring for better handling of resizing dialog
IBBoard <dev@ibboard.co.uk>
parents:
40
diff
changeset
|
261 // |
94
e4a8653b9536
Re #196: Add notes and abilities to UI
IBBoard <dev@ibboard.co.uk>
parents:
85
diff
changeset
|
262 this.lblEquip.Location = new System.Drawing.Point(15, 126); |
60
c283545d2d0b
Re #168: Combine "required" and "optional" equipment boxes
IBBoard <dev@ibboard.co.uk>
parents:
55
diff
changeset
|
263 this.lblEquip.Name = "lblEquip"; |
94
e4a8653b9536
Re #196: Add notes and abilities to UI
IBBoard <dev@ibboard.co.uk>
parents:
85
diff
changeset
|
264 this.lblEquip.Size = new System.Drawing.Size(81, 108); |
60
c283545d2d0b
Re #168: Combine "required" and "optional" equipment boxes
IBBoard <dev@ibboard.co.uk>
parents:
55
diff
changeset
|
265 this.lblEquip.TabIndex = 3; |
c283545d2d0b
Re #168: Combine "required" and "optional" equipment boxes
IBBoard <dev@ibboard.co.uk>
parents:
55
diff
changeset
|
266 this.lblEquip.Text = "equipment"; |
c283545d2d0b
Re #168: Combine "required" and "optional" equipment boxes
IBBoard <dev@ibboard.co.uk>
parents:
55
diff
changeset
|
267 this.lblEquip.TextAlign = System.Drawing.ContentAlignment.TopRight; |
51
53a18feb2370
* Set anchoring for better handling of resizing dialog
IBBoard <dev@ibboard.co.uk>
parents:
40
diff
changeset
|
268 // |
27
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
269 // bttnAddWeapon |
51
53a18feb2370
* Set anchoring for better handling of resizing dialog
IBBoard <dev@ibboard.co.uk>
parents:
40
diff
changeset
|
270 // |
55
346b4ac34997
Re #163: Unit cost on unit dialog
IBBoard <dev@ibboard.co.uk>
parents:
53
diff
changeset
|
271 this.bttnAddWeapon.Anchor = ((System.Windows.Forms.AnchorStyles) ((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); |
27
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
272 this.bttnAddWeapon.FlatStyle = System.Windows.Forms.FlatStyle.System; |
60
c283545d2d0b
Re #168: Combine "required" and "optional" equipment boxes
IBBoard <dev@ibboard.co.uk>
parents:
55
diff
changeset
|
273 this.bttnAddWeapon.Location = new System.Drawing.Point(516, 126); |
27
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
274 this.bttnAddWeapon.Name = "bttnAddWeapon"; |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
275 this.bttnAddWeapon.Size = new System.Drawing.Size(88, 22); |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
276 this.bttnAddWeapon.TabIndex = 4; |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
277 this.bttnAddWeapon.Text = "add"; |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
278 this.bttnAddWeapon.Click += new System.EventHandler(this.bttnAddWeapon_Click); |
51
53a18feb2370
* Set anchoring for better handling of resizing dialog
IBBoard <dev@ibboard.co.uk>
parents:
40
diff
changeset
|
279 // |
27
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
280 // bttnRemoveWeapon |
51
53a18feb2370
* Set anchoring for better handling of resizing dialog
IBBoard <dev@ibboard.co.uk>
parents:
40
diff
changeset
|
281 // |
55
346b4ac34997
Re #163: Unit cost on unit dialog
IBBoard <dev@ibboard.co.uk>
parents:
53
diff
changeset
|
282 this.bttnRemoveWeapon.Anchor = ((System.Windows.Forms.AnchorStyles) ((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); |
27
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
283 this.bttnRemoveWeapon.Enabled = false; |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
284 this.bttnRemoveWeapon.FlatStyle = System.Windows.Forms.FlatStyle.System; |
60
c283545d2d0b
Re #168: Combine "required" and "optional" equipment boxes
IBBoard <dev@ibboard.co.uk>
parents:
55
diff
changeset
|
285 this.bttnRemoveWeapon.Location = new System.Drawing.Point(516, 210); |
27
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
286 this.bttnRemoveWeapon.Name = "bttnRemoveWeapon"; |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
287 this.bttnRemoveWeapon.Size = new System.Drawing.Size(88, 22); |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
288 this.bttnRemoveWeapon.TabIndex = 5; |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
289 this.bttnRemoveWeapon.Text = "remove"; |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
290 this.bttnRemoveWeapon.Click += new System.EventHandler(this.bttnRemoveWeapon_Click); |
51
53a18feb2370
* Set anchoring for better handling of resizing dialog
IBBoard <dev@ibboard.co.uk>
parents:
40
diff
changeset
|
291 // |
60
c283545d2d0b
Re #168: Combine "required" and "optional" equipment boxes
IBBoard <dev@ibboard.co.uk>
parents:
55
diff
changeset
|
292 // equipmentList |
51
53a18feb2370
* Set anchoring for better handling of resizing dialog
IBBoard <dev@ibboard.co.uk>
parents:
40
diff
changeset
|
293 // |
60
c283545d2d0b
Re #168: Combine "required" and "optional" equipment boxes
IBBoard <dev@ibboard.co.uk>
parents:
55
diff
changeset
|
294 this.equipmentList.Anchor = ((System.Windows.Forms.AnchorStyles) (((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) |
51
53a18feb2370
* Set anchoring for better handling of resizing dialog
IBBoard <dev@ibboard.co.uk>
parents:
40
diff
changeset
|
295 | System.Windows.Forms.AnchorStyles.Right))); |
60
c283545d2d0b
Re #168: Combine "required" and "optional" equipment boxes
IBBoard <dev@ibboard.co.uk>
parents:
55
diff
changeset
|
296 this.equipmentList.Location = new System.Drawing.Point(102, 126); |
c283545d2d0b
Re #168: Combine "required" and "optional" equipment boxes
IBBoard <dev@ibboard.co.uk>
parents:
55
diff
changeset
|
297 this.equipmentList.Name = "equipmentList"; |
c283545d2d0b
Re #168: Combine "required" and "optional" equipment boxes
IBBoard <dev@ibboard.co.uk>
parents:
55
diff
changeset
|
298 this.equipmentList.Size = new System.Drawing.Size(408, 108); |
c283545d2d0b
Re #168: Combine "required" and "optional" equipment boxes
IBBoard <dev@ibboard.co.uk>
parents:
55
diff
changeset
|
299 this.equipmentList.TabIndex = 6; |
c283545d2d0b
Re #168: Combine "required" and "optional" equipment boxes
IBBoard <dev@ibboard.co.uk>
parents:
55
diff
changeset
|
300 this.equipmentList.DoubleClick += new System.EventHandler(this.equipmentList_DoubleClick); |
c283545d2d0b
Re #168: Combine "required" and "optional" equipment boxes
IBBoard <dev@ibboard.co.uk>
parents:
55
diff
changeset
|
301 this.equipmentList.SelectedIndexChanged += new System.EventHandler(this.equipmentList_SelectedIndexChanged); |
c283545d2d0b
Re #168: Combine "required" and "optional" equipment boxes
IBBoard <dev@ibboard.co.uk>
parents:
55
diff
changeset
|
302 // |
c283545d2d0b
Re #168: Combine "required" and "optional" equipment boxes
IBBoard <dev@ibboard.co.uk>
parents:
55
diff
changeset
|
303 // bttnReplaceWeapon |
c283545d2d0b
Re #168: Combine "required" and "optional" equipment boxes
IBBoard <dev@ibboard.co.uk>
parents:
55
diff
changeset
|
304 // |
c283545d2d0b
Re #168: Combine "required" and "optional" equipment boxes
IBBoard <dev@ibboard.co.uk>
parents:
55
diff
changeset
|
305 this.bttnReplaceWeapon.Anchor = ((System.Windows.Forms.AnchorStyles) ((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); |
c283545d2d0b
Re #168: Combine "required" and "optional" equipment boxes
IBBoard <dev@ibboard.co.uk>
parents:
55
diff
changeset
|
306 this.bttnReplaceWeapon.Enabled = false; |
c283545d2d0b
Re #168: Combine "required" and "optional" equipment boxes
IBBoard <dev@ibboard.co.uk>
parents:
55
diff
changeset
|
307 this.bttnReplaceWeapon.FlatStyle = System.Windows.Forms.FlatStyle.System; |
c283545d2d0b
Re #168: Combine "required" and "optional" equipment boxes
IBBoard <dev@ibboard.co.uk>
parents:
55
diff
changeset
|
308 this.bttnReplaceWeapon.Location = new System.Drawing.Point(516, 182); |
c283545d2d0b
Re #168: Combine "required" and "optional" equipment boxes
IBBoard <dev@ibboard.co.uk>
parents:
55
diff
changeset
|
309 this.bttnReplaceWeapon.Name = "bttnReplaceWeapon"; |
c283545d2d0b
Re #168: Combine "required" and "optional" equipment boxes
IBBoard <dev@ibboard.co.uk>
parents:
55
diff
changeset
|
310 this.bttnReplaceWeapon.Size = new System.Drawing.Size(88, 22); |
c283545d2d0b
Re #168: Combine "required" and "optional" equipment boxes
IBBoard <dev@ibboard.co.uk>
parents:
55
diff
changeset
|
311 this.bttnReplaceWeapon.TabIndex = 10; |
c283545d2d0b
Re #168: Combine "required" and "optional" equipment boxes
IBBoard <dev@ibboard.co.uk>
parents:
55
diff
changeset
|
312 this.bttnReplaceWeapon.Text = "replace"; |
c283545d2d0b
Re #168: Combine "required" and "optional" equipment boxes
IBBoard <dev@ibboard.co.uk>
parents:
55
diff
changeset
|
313 this.bttnReplaceWeapon.Click += new System.EventHandler(this.bttnReplaceWeapon_Click); |
51
53a18feb2370
* Set anchoring for better handling of resizing dialog
IBBoard <dev@ibboard.co.uk>
parents:
40
diff
changeset
|
314 // |
27
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
315 // bttnEditWeapon |
51
53a18feb2370
* Set anchoring for better handling of resizing dialog
IBBoard <dev@ibboard.co.uk>
parents:
40
diff
changeset
|
316 // |
55
346b4ac34997
Re #163: Unit cost on unit dialog
IBBoard <dev@ibboard.co.uk>
parents:
53
diff
changeset
|
317 this.bttnEditWeapon.Anchor = ((System.Windows.Forms.AnchorStyles) ((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); |
27
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
318 this.bttnEditWeapon.Enabled = false; |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
319 this.bttnEditWeapon.FlatStyle = System.Windows.Forms.FlatStyle.System; |
60
c283545d2d0b
Re #168: Combine "required" and "optional" equipment boxes
IBBoard <dev@ibboard.co.uk>
parents:
55
diff
changeset
|
320 this.bttnEditWeapon.Location = new System.Drawing.Point(516, 154); |
27
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
321 this.bttnEditWeapon.Name = "bttnEditWeapon"; |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
322 this.bttnEditWeapon.Size = new System.Drawing.Size(88, 22); |
60
c283545d2d0b
Re #168: Combine "required" and "optional" equipment boxes
IBBoard <dev@ibboard.co.uk>
parents:
55
diff
changeset
|
323 this.bttnEditWeapon.TabIndex = 11; |
27
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
324 this.bttnEditWeapon.Text = "edit"; |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
325 this.bttnEditWeapon.Click += new System.EventHandler(this.bttnEditWeapon_Click); |
51
53a18feb2370
* Set anchoring for better handling of resizing dialog
IBBoard <dev@ibboard.co.uk>
parents:
40
diff
changeset
|
326 // |
53
e6d0d9eababf
Fixes #163: Show unit cost on unit dialog
IBBoard <dev@ibboard.co.uk>
parents:
52
diff
changeset
|
327 // lblPoints |
e6d0d9eababf
Fixes #163: Show unit cost on unit dialog
IBBoard <dev@ibboard.co.uk>
parents:
52
diff
changeset
|
328 // |
e6d0d9eababf
Fixes #163: Show unit cost on unit dialog
IBBoard <dev@ibboard.co.uk>
parents:
52
diff
changeset
|
329 this.lblPoints.Location = new System.Drawing.Point(358, 8); |
e6d0d9eababf
Fixes #163: Show unit cost on unit dialog
IBBoard <dev@ibboard.co.uk>
parents:
52
diff
changeset
|
330 this.lblPoints.Name = "lblPoints"; |
55
346b4ac34997
Re #163: Unit cost on unit dialog
IBBoard <dev@ibboard.co.uk>
parents:
53
diff
changeset
|
331 this.lblPoints.Size = new System.Drawing.Size(88, 21); |
53
e6d0d9eababf
Fixes #163: Show unit cost on unit dialog
IBBoard <dev@ibboard.co.uk>
parents:
52
diff
changeset
|
332 this.lblPoints.TabIndex = 12; |
60
c283545d2d0b
Re #168: Combine "required" and "optional" equipment boxes
IBBoard <dev@ibboard.co.uk>
parents:
55
diff
changeset
|
333 this.lblPoints.Text = "(points)"; |
53
e6d0d9eababf
Fixes #163: Show unit cost on unit dialog
IBBoard <dev@ibboard.co.uk>
parents:
52
diff
changeset
|
334 // |
94
e4a8653b9536
Re #196: Add notes and abilities to UI
IBBoard <dev@ibboard.co.uk>
parents:
85
diff
changeset
|
335 // lblNotes |
e4a8653b9536
Re #196: Add notes and abilities to UI
IBBoard <dev@ibboard.co.uk>
parents:
85
diff
changeset
|
336 // |
e4a8653b9536
Re #196: Add notes and abilities to UI
IBBoard <dev@ibboard.co.uk>
parents:
85
diff
changeset
|
337 this.lblNotes.Location = new System.Drawing.Point(12, 240); |
e4a8653b9536
Re #196: Add notes and abilities to UI
IBBoard <dev@ibboard.co.uk>
parents:
85
diff
changeset
|
338 this.lblNotes.Name = "lblNotes"; |
e4a8653b9536
Re #196: Add notes and abilities to UI
IBBoard <dev@ibboard.co.uk>
parents:
85
diff
changeset
|
339 this.lblNotes.Size = new System.Drawing.Size(84, 62); |
e4a8653b9536
Re #196: Add notes and abilities to UI
IBBoard <dev@ibboard.co.uk>
parents:
85
diff
changeset
|
340 this.lblNotes.TabIndex = 13; |
e4a8653b9536
Re #196: Add notes and abilities to UI
IBBoard <dev@ibboard.co.uk>
parents:
85
diff
changeset
|
341 this.lblNotes.Text = "notes"; |
e4a8653b9536
Re #196: Add notes and abilities to UI
IBBoard <dev@ibboard.co.uk>
parents:
85
diff
changeset
|
342 this.lblNotes.TextAlign = System.Drawing.ContentAlignment.TopRight; |
e4a8653b9536
Re #196: Add notes and abilities to UI
IBBoard <dev@ibboard.co.uk>
parents:
85
diff
changeset
|
343 // |
e4a8653b9536
Re #196: Add notes and abilities to UI
IBBoard <dev@ibboard.co.uk>
parents:
85
diff
changeset
|
344 // notes |
e4a8653b9536
Re #196: Add notes and abilities to UI
IBBoard <dev@ibboard.co.uk>
parents:
85
diff
changeset
|
345 // |
e4a8653b9536
Re #196: Add notes and abilities to UI
IBBoard <dev@ibboard.co.uk>
parents:
85
diff
changeset
|
346 this.notes.Location = new System.Drawing.Point(101, 240); |
e4a8653b9536
Re #196: Add notes and abilities to UI
IBBoard <dev@ibboard.co.uk>
parents:
85
diff
changeset
|
347 this.notes.Multiline = true; |
e4a8653b9536
Re #196: Add notes and abilities to UI
IBBoard <dev@ibboard.co.uk>
parents:
85
diff
changeset
|
348 this.notes.Name = "notes"; |
e4a8653b9536
Re #196: Add notes and abilities to UI
IBBoard <dev@ibboard.co.uk>
parents:
85
diff
changeset
|
349 this.notes.ReadOnly = true; |
e4a8653b9536
Re #196: Add notes and abilities to UI
IBBoard <dev@ibboard.co.uk>
parents:
85
diff
changeset
|
350 this.notes.Size = new System.Drawing.Size(409, 62); |
e4a8653b9536
Re #196: Add notes and abilities to UI
IBBoard <dev@ibboard.co.uk>
parents:
85
diff
changeset
|
351 this.notes.TabIndex = 14; |
e4a8653b9536
Re #196: Add notes and abilities to UI
IBBoard <dev@ibboard.co.uk>
parents:
85
diff
changeset
|
352 // |
27
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
353 // FrmUnit |
51
53a18feb2370
* Set anchoring for better handling of resizing dialog
IBBoard <dev@ibboard.co.uk>
parents:
40
diff
changeset
|
354 // |
27
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
355 this.AutoScaleBaseSize = new System.Drawing.Size(5, 13); |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
356 this.ClientSize = new System.Drawing.Size(616, 314); |
94
e4a8653b9536
Re #196: Add notes and abilities to UI
IBBoard <dev@ibboard.co.uk>
parents:
85
diff
changeset
|
357 this.Controls.Add(this.notes); |
e4a8653b9536
Re #196: Add notes and abilities to UI
IBBoard <dev@ibboard.co.uk>
parents:
85
diff
changeset
|
358 this.Controls.Add(this.lblNotes); |
53
e6d0d9eababf
Fixes #163: Show unit cost on unit dialog
IBBoard <dev@ibboard.co.uk>
parents:
52
diff
changeset
|
359 this.Controls.Add(this.lblPoints); |
60
c283545d2d0b
Re #168: Combine "required" and "optional" equipment boxes
IBBoard <dev@ibboard.co.uk>
parents:
55
diff
changeset
|
360 this.Controls.Add(this.bttnEditWeapon); |
27
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
361 this.Controls.Add(this.bttnReplaceWeapon); |
60
c283545d2d0b
Re #168: Combine "required" and "optional" equipment boxes
IBBoard <dev@ibboard.co.uk>
parents:
55
diff
changeset
|
362 this.Controls.Add(this.equipmentList); |
27
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
363 this.Controls.Add(this.bttnRemoveWeapon); |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
364 this.Controls.Add(this.bttnAddWeapon); |
60
c283545d2d0b
Re #168: Combine "required" and "optional" equipment boxes
IBBoard <dev@ibboard.co.uk>
parents:
55
diff
changeset
|
365 this.Controls.Add(this.lblEquip); |
27
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
366 this.Controls.Add(this.lblUnitSize); |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
367 this.Controls.Add(this.unitSize); |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
368 this.Controls.Add(this.tbUnitName); |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
369 this.Controls.Add(this.statsGrid); |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
370 this.Name = "FrmUnit"; |
84
1e85a0687e4d
Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents:
72
diff
changeset
|
371 this.ShowIcon = false; |
27
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
372 this.ShowInTaskbar = false; |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
373 this.Text = "FrmUnit"; |
52
4a56900936aa
Fixes #165: Closing unit dialog that has unit name/size changes loses the changes
IBBoard <dev@ibboard.co.uk>
parents:
51
diff
changeset
|
374 this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.FrmUnit_FormClosing); |
55
346b4ac34997
Re #163: Unit cost on unit dialog
IBBoard <dev@ibboard.co.uk>
parents:
53
diff
changeset
|
375 ((System.ComponentModel.ISupportInitialize) (this.statsGrid)).EndInit(); |
346b4ac34997
Re #163: Unit cost on unit dialog
IBBoard <dev@ibboard.co.uk>
parents:
53
diff
changeset
|
376 ((System.ComponentModel.ISupportInitialize) (this.unitSize)).EndInit(); |
27
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
377 this.ResumeLayout(false); |
51
53a18feb2370
* Set anchoring for better handling of resizing dialog
IBBoard <dev@ibboard.co.uk>
parents:
40
diff
changeset
|
378 this.PerformLayout(); |
27
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
379 |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
380 } |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
381 #endregion |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
382 |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
383 public Unit Unit |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
384 { |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
385 get { return unit; } |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
386 } |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
387 |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
388 private void tbUnitName_Leave(object sender, System.EventArgs e) |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
389 { |
52
4a56900936aa
Fixes #165: Closing unit dialog that has unit name/size changes loses the changes
IBBoard <dev@ibboard.co.uk>
parents:
51
diff
changeset
|
390 UpdateUnitName(); |
27
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
391 } |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
392 |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
393 private void tbUnitName_KeyDown(object sender, System.Windows.Forms.KeyEventArgs e) |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
394 { |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
395 if (e.KeyCode == Keys.Enter) |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
396 { |
52
4a56900936aa
Fixes #165: Closing unit dialog that has unit name/size changes loses the changes
IBBoard <dev@ibboard.co.uk>
parents:
51
diff
changeset
|
397 UpdateUnitName(); |
27
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
398 } |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
399 } |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
400 |
52
4a56900936aa
Fixes #165: Closing unit dialog that has unit name/size changes loses the changes
IBBoard <dev@ibboard.co.uk>
parents:
51
diff
changeset
|
401 private void UpdateUnitName() |
27
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
402 { |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
403 if (unit.Name != tbUnitName.Text) |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
404 { |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
405 commandStack.Execute(new SetNameCommand(unit, tbUnitName.Text)); |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
406 } |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
407 } |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
408 |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
409 private void unitSize_Leave(object sender, System.EventArgs e) |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
410 { |
52
4a56900936aa
Fixes #165: Closing unit dialog that has unit name/size changes loses the changes
IBBoard <dev@ibboard.co.uk>
parents:
51
diff
changeset
|
411 UpdateUnitSize(); |
27
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
412 } |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
413 |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
414 private void unitSize_KeyDown(object sender, System.Windows.Forms.KeyEventArgs e) |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
415 { |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
416 if (e.KeyCode == Keys.Enter) |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
417 { |
52
4a56900936aa
Fixes #165: Closing unit dialog that has unit name/size changes loses the changes
IBBoard <dev@ibboard.co.uk>
parents:
51
diff
changeset
|
418 UpdateUnitSize(); |
27
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
419 } |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
420 } |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
421 |
52
4a56900936aa
Fixes #165: Closing unit dialog that has unit name/size changes loses the changes
IBBoard <dev@ibboard.co.uk>
parents:
51
diff
changeset
|
422 private void UpdateUnitSize() |
27
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
423 { |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
424 if (unit.Size != unitSize.Value) |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
425 { |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
426 commandStack.Execute(new SetUnitSizeCommand(unit, (int) unitSize.Value)); |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
427 } |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
428 } |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
429 |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
430 private void unit_NameChanged(WarFoundryObject obj, string oldValue, string newValue) |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
431 { |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
432 if (obj is Unit && obj.Equals(unit)) |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
433 { |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
434 Unit u = (Unit) obj; |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
435 tbUnitName.Text = obj.Name; |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
436 Text = obj.Name; |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
437 } |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
438 } |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
439 |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
440 private void unit_UnitSizeChanged(WarFoundryObject obj, int oldValue, int newValue) |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
441 { |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
442 if (obj is Unit && obj.Equals(unit)) |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
443 { |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
444 unitSize.Value = newValue; |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
445 } |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
446 } |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
447 |
60
c283545d2d0b
Re #168: Combine "required" and "optional" equipment boxes
IBBoard <dev@ibboard.co.uk>
parents:
55
diff
changeset
|
448 private void equipmentList_SelectedIndexChanged(object sender, System.EventArgs e) |
27
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
449 { |
60
c283545d2d0b
Re #168: Combine "required" and "optional" equipment boxes
IBBoard <dev@ibboard.co.uk>
parents:
55
diff
changeset
|
450 SetButtonsEnabledState(); |
27
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
451 } |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
452 |
60
c283545d2d0b
Re #168: Combine "required" and "optional" equipment boxes
IBBoard <dev@ibboard.co.uk>
parents:
55
diff
changeset
|
453 private void SetButtonsEnabledState() |
27
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
454 { |
60
c283545d2d0b
Re #168: Combine "required" and "optional" equipment boxes
IBBoard <dev@ibboard.co.uk>
parents:
55
diff
changeset
|
455 |
c283545d2d0b
Re #168: Combine "required" and "optional" equipment boxes
IBBoard <dev@ibboard.co.uk>
parents:
55
diff
changeset
|
456 UnitEquipmentItem equipItem = GetSelectedUnitEquipmentItem(); |
c283545d2d0b
Re #168: Combine "required" and "optional" equipment boxes
IBBoard <dev@ibboard.co.uk>
parents:
55
diff
changeset
|
457 bttnReplaceWeapon.Enabled = (equipItem != null && equipItem.HasAlternatives()); |
c283545d2d0b
Re #168: Combine "required" and "optional" equipment boxes
IBBoard <dev@ibboard.co.uk>
parents:
55
diff
changeset
|
458 bttnEditWeapon.Enabled = (equipItem != null); |
c283545d2d0b
Re #168: Combine "required" and "optional" equipment boxes
IBBoard <dev@ibboard.co.uk>
parents:
55
diff
changeset
|
459 bttnRemoveWeapon.Enabled = (equipItem != null && !equipItem.IsRequired); |
27
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
460 } |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
461 |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
462 private void unit_UnitEquipmentAmountChanged(WarFoundryObject obj, double oldValue, double newValue) |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
463 { |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
464 if (obj is UnitEquipmentItem) |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
465 { |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
466 UnitEquipmentItem equip = (UnitEquipmentItem) obj; |
60
c283545d2d0b
Re #168: Combine "required" and "optional" equipment boxes
IBBoard <dev@ibboard.co.uk>
parents:
55
diff
changeset
|
467 UnitEquipmentChoice equipChoice = GetEquipmentChoice(equip); |
27
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
468 |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
469 if (newValue == 0) |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
470 { |
60
c283545d2d0b
Re #168: Combine "required" and "optional" equipment boxes
IBBoard <dev@ibboard.co.uk>
parents:
55
diff
changeset
|
471 equipmentList.Items.Remove(equipChoice); |
27
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
472 } |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
473 else |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
474 { |
60
c283545d2d0b
Re #168: Combine "required" and "optional" equipment boxes
IBBoard <dev@ibboard.co.uk>
parents:
55
diff
changeset
|
475 int idx = equipmentList.Items.IndexOf(equipChoice); |
27
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
476 |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
477 if (idx > -1) |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
478 { |
60
c283545d2d0b
Re #168: Combine "required" and "optional" equipment boxes
IBBoard <dev@ibboard.co.uk>
parents:
55
diff
changeset
|
479 equipmentList.Items[idx] = equipChoice; |
27
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
480 } |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
481 else |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
482 { |
60
c283545d2d0b
Re #168: Combine "required" and "optional" equipment boxes
IBBoard <dev@ibboard.co.uk>
parents:
55
diff
changeset
|
483 equipmentList.Items.Add(equipChoice); |
27
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
484 } |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
485 } |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
486 } |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
487 } |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
488 |
60
c283545d2d0b
Re #168: Combine "required" and "optional" equipment boxes
IBBoard <dev@ibboard.co.uk>
parents:
55
diff
changeset
|
489 private void EditWeapon() |
c283545d2d0b
Re #168: Combine "required" and "optional" equipment boxes
IBBoard <dev@ibboard.co.uk>
parents:
55
diff
changeset
|
490 { |
72
9a215113c84c
Re #184: Unhandled exception in the unit form
IBBoard <dev@ibboard.co.uk>
parents:
62
diff
changeset
|
491 UnitEquipmentItem item = GetSelectedUnitEquipmentItem(); |
9a215113c84c
Re #184: Unhandled exception in the unit form
IBBoard <dev@ibboard.co.uk>
parents:
62
diff
changeset
|
492 |
9a215113c84c
Re #184: Unhandled exception in the unit form
IBBoard <dev@ibboard.co.uk>
parents:
62
diff
changeset
|
493 if (item != null) |
9a215113c84c
Re #184: Unhandled exception in the unit form
IBBoard <dev@ibboard.co.uk>
parents:
62
diff
changeset
|
494 { |
9a215113c84c
Re #184: Unhandled exception in the unit form
IBBoard <dev@ibboard.co.uk>
parents:
62
diff
changeset
|
495 FrmEditUnitEquipment editEquip = new FrmEditUnitEquipment(Unit, item, commandStack); |
9a215113c84c
Re #184: Unhandled exception in the unit form
IBBoard <dev@ibboard.co.uk>
parents:
62
diff
changeset
|
496 editEquip.ShowDialog(this); |
9a215113c84c
Re #184: Unhandled exception in the unit form
IBBoard <dev@ibboard.co.uk>
parents:
62
diff
changeset
|
497 } |
60
c283545d2d0b
Re #168: Combine "required" and "optional" equipment boxes
IBBoard <dev@ibboard.co.uk>
parents:
55
diff
changeset
|
498 } |
c283545d2d0b
Re #168: Combine "required" and "optional" equipment boxes
IBBoard <dev@ibboard.co.uk>
parents:
55
diff
changeset
|
499 |
c283545d2d0b
Re #168: Combine "required" and "optional" equipment boxes
IBBoard <dev@ibboard.co.uk>
parents:
55
diff
changeset
|
500 private UnitEquipmentItem GetSelectedUnitEquipmentItem() |
27
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
501 { |
60
c283545d2d0b
Re #168: Combine "required" and "optional" equipment boxes
IBBoard <dev@ibboard.co.uk>
parents:
55
diff
changeset
|
502 UnitEquipmentChoice selectedItem = GetSelectedUnitEquipmentChoice(); |
c283545d2d0b
Re #168: Combine "required" and "optional" equipment boxes
IBBoard <dev@ibboard.co.uk>
parents:
55
diff
changeset
|
503 UnitEquipmentItem equipItem = null; |
c283545d2d0b
Re #168: Combine "required" and "optional" equipment boxes
IBBoard <dev@ibboard.co.uk>
parents:
55
diff
changeset
|
504 |
c283545d2d0b
Re #168: Combine "required" and "optional" equipment boxes
IBBoard <dev@ibboard.co.uk>
parents:
55
diff
changeset
|
505 if (selectedItem!=null) |
c283545d2d0b
Re #168: Combine "required" and "optional" equipment boxes
IBBoard <dev@ibboard.co.uk>
parents:
55
diff
changeset
|
506 { |
c283545d2d0b
Re #168: Combine "required" and "optional" equipment boxes
IBBoard <dev@ibboard.co.uk>
parents:
55
diff
changeset
|
507 equipItem = selectedItem.Item; |
c283545d2d0b
Re #168: Combine "required" and "optional" equipment boxes
IBBoard <dev@ibboard.co.uk>
parents:
55
diff
changeset
|
508 } |
c283545d2d0b
Re #168: Combine "required" and "optional" equipment boxes
IBBoard <dev@ibboard.co.uk>
parents:
55
diff
changeset
|
509 |
c283545d2d0b
Re #168: Combine "required" and "optional" equipment boxes
IBBoard <dev@ibboard.co.uk>
parents:
55
diff
changeset
|
510 return equipItem; |
c283545d2d0b
Re #168: Combine "required" and "optional" equipment boxes
IBBoard <dev@ibboard.co.uk>
parents:
55
diff
changeset
|
511 } |
c283545d2d0b
Re #168: Combine "required" and "optional" equipment boxes
IBBoard <dev@ibboard.co.uk>
parents:
55
diff
changeset
|
512 |
c283545d2d0b
Re #168: Combine "required" and "optional" equipment boxes
IBBoard <dev@ibboard.co.uk>
parents:
55
diff
changeset
|
513 private UnitEquipmentChoice GetSelectedUnitEquipmentChoice() |
c283545d2d0b
Re #168: Combine "required" and "optional" equipment boxes
IBBoard <dev@ibboard.co.uk>
parents:
55
diff
changeset
|
514 { |
c283545d2d0b
Re #168: Combine "required" and "optional" equipment boxes
IBBoard <dev@ibboard.co.uk>
parents:
55
diff
changeset
|
515 return (UnitEquipmentChoice) equipmentList.SelectedItem; |
27
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
516 } |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
517 |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
518 private void bttnEditWeapon_Click(object sender, System.EventArgs e) |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
519 { |
60
c283545d2d0b
Re #168: Combine "required" and "optional" equipment boxes
IBBoard <dev@ibboard.co.uk>
parents:
55
diff
changeset
|
520 EditWeapon(); |
27
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
521 } |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
522 |
60
c283545d2d0b
Re #168: Combine "required" and "optional" equipment boxes
IBBoard <dev@ibboard.co.uk>
parents:
55
diff
changeset
|
523 private void equipmentList_DoubleClick(object sender, System.EventArgs e) |
27
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
524 { |
60
c283545d2d0b
Re #168: Combine "required" and "optional" equipment boxes
IBBoard <dev@ibboard.co.uk>
parents:
55
diff
changeset
|
525 EditWeapon(); |
27
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
526 } |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
527 |
60
c283545d2d0b
Re #168: Combine "required" and "optional" equipment boxes
IBBoard <dev@ibboard.co.uk>
parents:
55
diff
changeset
|
528 private void AddWeapon() |
27
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
529 { |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
530 FrmNewUnitEquipment newEquip = new FrmNewUnitEquipment(Unit, commandStack); |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
531 newEquip.ShowDialog(this); |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
532 } |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
533 |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
534 private void bttnAddWeapon_Click(object sender, System.EventArgs e) |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
535 { |
60
c283545d2d0b
Re #168: Combine "required" and "optional" equipment boxes
IBBoard <dev@ibboard.co.uk>
parents:
55
diff
changeset
|
536 AddWeapon(); |
27
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
537 } |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
538 |
60
c283545d2d0b
Re #168: Combine "required" and "optional" equipment boxes
IBBoard <dev@ibboard.co.uk>
parents:
55
diff
changeset
|
539 private void RemoveWeapon() |
27
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
540 { |
60
c283545d2d0b
Re #168: Combine "required" and "optional" equipment boxes
IBBoard <dev@ibboard.co.uk>
parents:
55
diff
changeset
|
541 commandStack.Execute(new SetUnitEquipmentNumericAmountCommand(unit, GetSelectedUnitEquipmentItem(), 0)); |
27
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
542 } |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
543 |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
544 private void bttnRemoveWeapon_Click(object sender, System.EventArgs e) |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
545 { |
60
c283545d2d0b
Re #168: Combine "required" and "optional" equipment boxes
IBBoard <dev@ibboard.co.uk>
parents:
55
diff
changeset
|
546 RemoveWeapon(); |
27
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
547 } |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
548 |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
549 private void bttnReplaceWeapon_Click(object sender, System.EventArgs e) |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
550 { |
60
c283545d2d0b
Re #168: Combine "required" and "optional" equipment boxes
IBBoard <dev@ibboard.co.uk>
parents:
55
diff
changeset
|
551 FrmReplaceUnitEquipment replace = new FrmReplaceUnitEquipment(unit, GetSelectedUnitEquipmentItem(), commandStack); |
27
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
552 replace.ShowDialog(this); |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
553 } |
52
4a56900936aa
Fixes #165: Closing unit dialog that has unit name/size changes loses the changes
IBBoard <dev@ibboard.co.uk>
parents:
51
diff
changeset
|
554 |
4a56900936aa
Fixes #165: Closing unit dialog that has unit name/size changes loses the changes
IBBoard <dev@ibboard.co.uk>
parents:
51
diff
changeset
|
555 private void FrmUnit_FormClosing(object sender, FormClosingEventArgs e) |
4a56900936aa
Fixes #165: Closing unit dialog that has unit name/size changes loses the changes
IBBoard <dev@ibboard.co.uk>
parents:
51
diff
changeset
|
556 { |
4a56900936aa
Fixes #165: Closing unit dialog that has unit name/size changes loses the changes
IBBoard <dev@ibboard.co.uk>
parents:
51
diff
changeset
|
557 UpdateUnitName(); |
4a56900936aa
Fixes #165: Closing unit dialog that has unit name/size changes loses the changes
IBBoard <dev@ibboard.co.uk>
parents:
51
diff
changeset
|
558 UpdateUnitSize(); |
4a56900936aa
Fixes #165: Closing unit dialog that has unit name/size changes loses the changes
IBBoard <dev@ibboard.co.uk>
parents:
51
diff
changeset
|
559 } |
27
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
560 } |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
561 } |