Mercurial > repos > IBDev-IBBoard.WarFoundry.GUI.WinForms
annotate FrmUnit.cs @ 153:fcd90498d9a2
Re #269: Handle multiple stat lines
* Improve rendering of stats
* Fix column widths
* Set width and height based on content
Also:
* Make FrmUnit title contain unit type as we're using it more now
Still needs more testing and fixing
author | IBBoard <dev@ibboard.co.uk> |
---|---|
date | Wed, 26 May 2010 20:05:20 +0000 |
parents | 540c8aa6e565 |
children | 24d0cfaa95da |
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 { |
153
fcd90498d9a2
Re #269: Handle multiple stat lines
IBBoard <dev@ibboard.co.uk>
parents:
151
diff
changeset
|
28 private static readonly int COLUMN_WIDTH = 40; |
fcd90498d9a2
Re #269: Handle multiple stat lines
IBBoard <dev@ibboard.co.uk>
parents:
151
diff
changeset
|
29 private static readonly int BORDER_WIDTH = 1; |
27
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
30 private Unit unit; |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
31 private Dictionary<UnitEquipmentItem, UnitEquipmentChoice> equipmentChoices = new Dictionary<UnitEquipmentItem, UnitEquipmentChoice>(); |
151
540c8aa6e565
Re #269: Handle multiple stat lines
IBBoard <dev@ibboard.co.uk>
parents:
150
diff
changeset
|
32 private Dictionary<string, DataGridView> DataGridViews = new Dictionary<string, DataGridView>(); |
27
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
33 private CommandStack commandStack; |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
34 private System.Windows.Forms.TextBox tbUnitName; |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
35 private System.Windows.Forms.NumericUpDown unitSize; |
85
0bb9f40d44eb
Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents:
84
diff
changeset
|
36 private IBBLabel lblUnitSize; |
0bb9f40d44eb
Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents:
84
diff
changeset
|
37 private IBBButton bttnAddWeapon; |
0bb9f40d44eb
Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents:
84
diff
changeset
|
38 private IBBButton bttnRemoveWeapon; |
0bb9f40d44eb
Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents:
84
diff
changeset
|
39 private IBBLabel lblEquip; |
60
c283545d2d0b
Re #168: Combine "required" and "optional" equipment boxes
IBBoard <dev@ibboard.co.uk>
parents:
55
diff
changeset
|
40 private System.Windows.Forms.ListBox equipmentList; |
85
0bb9f40d44eb
Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents:
84
diff
changeset
|
41 private IBBButton bttnReplaceWeapon; |
0bb9f40d44eb
Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents:
84
diff
changeset
|
42 private IBBButton bttnEditWeapon; |
53
e6d0d9eababf
Fixes #163: Show unit cost on unit dialog
IBBoard <dev@ibboard.co.uk>
parents:
52
diff
changeset
|
43 private Label lblPoints; |
94
e4a8653b9536
Re #196: Add notes and abilities to UI
IBBoard <dev@ibboard.co.uk>
parents:
85
diff
changeset
|
44 private IBBLabel lblNotes; |
e4a8653b9536
Re #196: Add notes and abilities to UI
IBBoard <dev@ibboard.co.uk>
parents:
85
diff
changeset
|
45 private TextBox notes; |
95
83c259516041
Fixes #196: Add notes and abilities to UI
IBBoard <dev@ibboard.co.uk>
parents:
94
diff
changeset
|
46 private ListBox abilitiesList; |
83c259516041
Fixes #196: Add notes and abilities to UI
IBBoard <dev@ibboard.co.uk>
parents:
94
diff
changeset
|
47 private IBBLabel lblAbilities; |
150
0e3837170637
Re #269: Handle multiple stat lines
IBBoard <dev@ibboard.co.uk>
parents:
145
diff
changeset
|
48 private Panel statsPanel; |
27
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
49 /// <summary> |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
50 /// Required designer variable. |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
51 /// </summary> |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
52 private System.ComponentModel.Container components = null; |
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 public FrmUnit(Unit toDisplay, CommandStack cmdStack) |
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 unit = toDisplay; |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
57 commandStack = cmdStack; |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
58 // |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
59 // Required for Windows Form Designer support |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
60 // |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
61 InitializeComponent(); |
143
28105d9c2b25
Re #265: Add language preference UI
IBBoard <dev@ibboard.co.uk>
parents:
138
diff
changeset
|
62 TranslateForm(); |
28105d9c2b25
Re #265: Add language preference UI
IBBoard <dev@ibboard.co.uk>
parents:
138
diff
changeset
|
63 Translation.TranslationChanged += new MethodInvoker(TranslateForm); |
27
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
64 unit.NameChanged += new StringValChangedDelegate(unit_NameChanged); |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
65 unit.UnitSizeChanged += new IntValChangedDelegate(unit_UnitSizeChanged); |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
66 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
|
67 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
|
68 |
95
83c259516041
Fixes #196: Add notes and abilities to UI
IBBoard <dev@ibboard.co.uk>
parents:
94
diff
changeset
|
69 unitSize.Value = unit.Size; |
83c259516041
Fixes #196: Add notes and abilities to UI
IBBoard <dev@ibboard.co.uk>
parents:
94
diff
changeset
|
70 unitSize.Maximum = (unit.UnitType.MaxSize == WarFoundryCore.INFINITY ? int.MaxValue : unit.UnitType.MaxSize); |
83c259516041
Fixes #196: Add notes and abilities to UI
IBBoard <dev@ibboard.co.uk>
parents:
94
diff
changeset
|
71 unitSize.Minimum = unit.UnitType.MinSize; |
83c259516041
Fixes #196: Add notes and abilities to UI
IBBoard <dev@ibboard.co.uk>
parents:
94
diff
changeset
|
72 unitSize.Enabled = (unitSize.Maximum != unitSize.Minimum); |
27
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
73 |
94
e4a8653b9536
Re #196: Add notes and abilities to UI
IBBoard <dev@ibboard.co.uk>
parents:
85
diff
changeset
|
74 notes.Text = unit.UnitType.Notes; |
95
83c259516041
Fixes #196: Add notes and abilities to UI
IBBoard <dev@ibboard.co.uk>
parents:
94
diff
changeset
|
75 abilitiesList.DataSource = new List<Ability>(unit.UnitType.GetRequiredAbilities()); |
83c259516041
Fixes #196: Add notes and abilities to UI
IBBoard <dev@ibboard.co.uk>
parents:
94
diff
changeset
|
76 abilitiesList.DisplayMember = "Name"; |
53
e6d0d9eababf
Fixes #163: Show unit cost on unit dialog
IBBoard <dev@ibboard.co.uk>
parents:
52
diff
changeset
|
77 SetPointsValueText(); |
27
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
78 SetStats(); |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
79 SetWeapons(); |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
80 } |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
81 |
143
28105d9c2b25
Re #265: Add language preference UI
IBBoard <dev@ibboard.co.uk>
parents:
138
diff
changeset
|
82 private void TranslateForm() |
28105d9c2b25
Re #265: Add language preference UI
IBBoard <dev@ibboard.co.uk>
parents:
138
diff
changeset
|
83 { |
28105d9c2b25
Re #265: Add language preference UI
IBBoard <dev@ibboard.co.uk>
parents:
138
diff
changeset
|
84 ControlTranslator.TranslateControl(this); |
153
fcd90498d9a2
Re #269: Handle multiple stat lines
IBBoard <dev@ibboard.co.uk>
parents:
151
diff
changeset
|
85 SetUnitName(); |
fcd90498d9a2
Re #269: Handle multiple stat lines
IBBoard <dev@ibboard.co.uk>
parents:
151
diff
changeset
|
86 RefreshUnitEquipment(); |
fcd90498d9a2
Re #269: Handle multiple stat lines
IBBoard <dev@ibboard.co.uk>
parents:
151
diff
changeset
|
87 } |
fcd90498d9a2
Re #269: Handle multiple stat lines
IBBoard <dev@ibboard.co.uk>
parents:
151
diff
changeset
|
88 |
fcd90498d9a2
Re #269: Handle multiple stat lines
IBBoard <dev@ibboard.co.uk>
parents:
151
diff
changeset
|
89 private void SetUnitName() |
fcd90498d9a2
Re #269: Handle multiple stat lines
IBBoard <dev@ibboard.co.uk>
parents:
151
diff
changeset
|
90 { |
143
28105d9c2b25
Re #265: Add language preference UI
IBBoard <dev@ibboard.co.uk>
parents:
138
diff
changeset
|
91 tbUnitName.Text = unit.Name; |
153
fcd90498d9a2
Re #269: Handle multiple stat lines
IBBoard <dev@ibboard.co.uk>
parents:
151
diff
changeset
|
92 Text = Translation.GetTranslation("FrmUnit", "{0} ({1})", unit.Name, unit.UnitType.Name); |
143
28105d9c2b25
Re #265: Add language preference UI
IBBoard <dev@ibboard.co.uk>
parents:
138
diff
changeset
|
93 } |
28105d9c2b25
Re #265: Add language preference UI
IBBoard <dev@ibboard.co.uk>
parents:
138
diff
changeset
|
94 |
53
e6d0d9eababf
Fixes #163: Show unit cost on unit dialog
IBBoard <dev@ibboard.co.uk>
parents:
52
diff
changeset
|
95 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
|
96 { |
e6d0d9eababf
Fixes #163: Show unit cost on unit dialog
IBBoard <dev@ibboard.co.uk>
parents:
52
diff
changeset
|
97 SetPointsValueText(); |
e6d0d9eababf
Fixes #163: Show unit cost on unit dialog
IBBoard <dev@ibboard.co.uk>
parents:
52
diff
changeset
|
98 } |
e6d0d9eababf
Fixes #163: Show unit cost on unit dialog
IBBoard <dev@ibboard.co.uk>
parents:
52
diff
changeset
|
99 |
e6d0d9eababf
Fixes #163: Show unit cost on unit dialog
IBBoard <dev@ibboard.co.uk>
parents:
52
diff
changeset
|
100 private void SetPointsValueText() |
e6d0d9eababf
Fixes #163: Show unit cost on unit dialog
IBBoard <dev@ibboard.co.uk>
parents:
52
diff
changeset
|
101 { |
62
0e7c257ca8d6
Fixes #164: Show unit cost in army tree
IBBoard <dev@ibboard.co.uk>
parents:
60
diff
changeset
|
102 lblPoints.Text = "(" + unit.Points + " pts)"; |
53
e6d0d9eababf
Fixes #163: Show unit cost on unit dialog
IBBoard <dev@ibboard.co.uk>
parents:
52
diff
changeset
|
103 } |
e6d0d9eababf
Fixes #163: Show unit cost on unit dialog
IBBoard <dev@ibboard.co.uk>
parents:
52
diff
changeset
|
104 |
27
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
105 private void SetStats() |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
106 { |
150
0e3837170637
Re #269: Handle multiple stat lines
IBBoard <dev@ibboard.co.uk>
parents:
145
diff
changeset
|
107 Stat[][] stats = unit.UnitStatsArraysWithName; |
0e3837170637
Re #269: Handle multiple stat lines
IBBoard <dev@ibboard.co.uk>
parents:
145
diff
changeset
|
108 string[] statsIDs = unit.UnitStatsArrayIDs; |
27
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
109 int statsCount = stats.Length; |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
110 |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
111 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
|
112 { |
151
540c8aa6e565
Re #269: Handle multiple stat lines
IBBoard <dev@ibboard.co.uk>
parents:
150
diff
changeset
|
113 DataGridView statsGrid = GetDataGridView(statsIDs[i]); |
150
0e3837170637
Re #269: Handle multiple stat lines
IBBoard <dev@ibboard.co.uk>
parents:
145
diff
changeset
|
114 DataTable dt = (DataTable)statsGrid.DataSource; |
0e3837170637
Re #269: Handle multiple stat lines
IBBoard <dev@ibboard.co.uk>
parents:
145
diff
changeset
|
115 DataRow dr = dt.NewRow(); |
0e3837170637
Re #269: Handle multiple stat lines
IBBoard <dev@ibboard.co.uk>
parents:
145
diff
changeset
|
116 dr.ItemArray = stats[i]; |
0e3837170637
Re #269: Handle multiple stat lines
IBBoard <dev@ibboard.co.uk>
parents:
145
diff
changeset
|
117 dt.Rows.Add(dr); |
153
fcd90498d9a2
Re #269: Handle multiple stat lines
IBBoard <dev@ibboard.co.uk>
parents:
151
diff
changeset
|
118 statsGrid.SelectedCells[0].Selected = false; |
150
0e3837170637
Re #269: Handle multiple stat lines
IBBoard <dev@ibboard.co.uk>
parents:
145
diff
changeset
|
119 } |
0e3837170637
Re #269: Handle multiple stat lines
IBBoard <dev@ibboard.co.uk>
parents:
145
diff
changeset
|
120 } |
0e3837170637
Re #269: Handle multiple stat lines
IBBoard <dev@ibboard.co.uk>
parents:
145
diff
changeset
|
121 |
151
540c8aa6e565
Re #269: Handle multiple stat lines
IBBoard <dev@ibboard.co.uk>
parents:
150
diff
changeset
|
122 private DataGridView GetDataGridView(string statsID) |
150
0e3837170637
Re #269: Handle multiple stat lines
IBBoard <dev@ibboard.co.uk>
parents:
145
diff
changeset
|
123 { |
151
540c8aa6e565
Re #269: Handle multiple stat lines
IBBoard <dev@ibboard.co.uk>
parents:
150
diff
changeset
|
124 DataGridView grid; |
150
0e3837170637
Re #269: Handle multiple stat lines
IBBoard <dev@ibboard.co.uk>
parents:
145
diff
changeset
|
125 |
151
540c8aa6e565
Re #269: Handle multiple stat lines
IBBoard <dev@ibboard.co.uk>
parents:
150
diff
changeset
|
126 if (DataGridViews.ContainsKey(statsID)) |
150
0e3837170637
Re #269: Handle multiple stat lines
IBBoard <dev@ibboard.co.uk>
parents:
145
diff
changeset
|
127 { |
151
540c8aa6e565
Re #269: Handle multiple stat lines
IBBoard <dev@ibboard.co.uk>
parents:
150
diff
changeset
|
128 grid = DictionaryUtils.GetValue(DataGridViews, statsID); |
150
0e3837170637
Re #269: Handle multiple stat lines
IBBoard <dev@ibboard.co.uk>
parents:
145
diff
changeset
|
129 } |
0e3837170637
Re #269: Handle multiple stat lines
IBBoard <dev@ibboard.co.uk>
parents:
145
diff
changeset
|
130 else |
0e3837170637
Re #269: Handle multiple stat lines
IBBoard <dev@ibboard.co.uk>
parents:
145
diff
changeset
|
131 { |
151
540c8aa6e565
Re #269: Handle multiple stat lines
IBBoard <dev@ibboard.co.uk>
parents:
150
diff
changeset
|
132 grid = CreateDataGridView(statsID); |
540c8aa6e565
Re #269: Handle multiple stat lines
IBBoard <dev@ibboard.co.uk>
parents:
150
diff
changeset
|
133 DataGridViews[statsID] = grid; |
150
0e3837170637
Re #269: Handle multiple stat lines
IBBoard <dev@ibboard.co.uk>
parents:
145
diff
changeset
|
134 } |
0e3837170637
Re #269: Handle multiple stat lines
IBBoard <dev@ibboard.co.uk>
parents:
145
diff
changeset
|
135 |
0e3837170637
Re #269: Handle multiple stat lines
IBBoard <dev@ibboard.co.uk>
parents:
145
diff
changeset
|
136 return grid; |
0e3837170637
Re #269: Handle multiple stat lines
IBBoard <dev@ibboard.co.uk>
parents:
145
diff
changeset
|
137 } |
0e3837170637
Re #269: Handle multiple stat lines
IBBoard <dev@ibboard.co.uk>
parents:
145
diff
changeset
|
138 |
151
540c8aa6e565
Re #269: Handle multiple stat lines
IBBoard <dev@ibboard.co.uk>
parents:
150
diff
changeset
|
139 private DataGridView CreateDataGridView(string statsID) |
150
0e3837170637
Re #269: Handle multiple stat lines
IBBoard <dev@ibboard.co.uk>
parents:
145
diff
changeset
|
140 { |
0e3837170637
Re #269: Handle multiple stat lines
IBBoard <dev@ibboard.co.uk>
parents:
145
diff
changeset
|
141 SystemStats sysStats = unit.Race.GameSystem.GetSystemStatsForID(statsID); |
0e3837170637
Re #269: Handle multiple stat lines
IBBoard <dev@ibboard.co.uk>
parents:
145
diff
changeset
|
142 StatSlot[] sysStatSlots = sysStats.StatSlots; |
151
540c8aa6e565
Re #269: Handle multiple stat lines
IBBoard <dev@ibboard.co.uk>
parents:
150
diff
changeset
|
143 StatSlot[] statsWithName = new StatSlot[sysStatSlots.Length + 1]; |
540c8aa6e565
Re #269: Handle multiple stat lines
IBBoard <dev@ibboard.co.uk>
parents:
150
diff
changeset
|
144 statsWithName[0] = new StatSlot("Name"); |
540c8aa6e565
Re #269: Handle multiple stat lines
IBBoard <dev@ibboard.co.uk>
parents:
150
diff
changeset
|
145 sysStatSlots.CopyTo(statsWithName, 1); |
150
0e3837170637
Re #269: Handle multiple stat lines
IBBoard <dev@ibboard.co.uk>
parents:
145
diff
changeset
|
146 DataTable dt = new DataTable(); |
151
540c8aa6e565
Re #269: Handle multiple stat lines
IBBoard <dev@ibboard.co.uk>
parents:
150
diff
changeset
|
147 int statsCount = statsWithName.Length; |
153
fcd90498d9a2
Re #269: Handle multiple stat lines
IBBoard <dev@ibboard.co.uk>
parents:
151
diff
changeset
|
148 DataGridView statsGrid = CreateDataGridView(); |
fcd90498d9a2
Re #269: Handle multiple stat lines
IBBoard <dev@ibboard.co.uk>
parents:
151
diff
changeset
|
149 statsGrid.DataSource = dt; |
150
0e3837170637
Re #269: Handle multiple stat lines
IBBoard <dev@ibboard.co.uk>
parents:
145
diff
changeset
|
150 |
0e3837170637
Re #269: Handle multiple stat lines
IBBoard <dev@ibboard.co.uk>
parents:
145
diff
changeset
|
151 for (int i = 0; i < statsCount; i++) |
0e3837170637
Re #269: Handle multiple stat lines
IBBoard <dev@ibboard.co.uk>
parents:
145
diff
changeset
|
152 { |
151
540c8aa6e565
Re #269: Handle multiple stat lines
IBBoard <dev@ibboard.co.uk>
parents:
150
diff
changeset
|
153 StatSlot stat = statsWithName[i]; |
150
0e3837170637
Re #269: Handle multiple stat lines
IBBoard <dev@ibboard.co.uk>
parents:
145
diff
changeset
|
154 string slotName = stat.Name; |
153
fcd90498d9a2
Re #269: Handle multiple stat lines
IBBoard <dev@ibboard.co.uk>
parents:
151
diff
changeset
|
155 dt.Columns.Add(CreateDataColumn(slotName)); |
fcd90498d9a2
Re #269: Handle multiple stat lines
IBBoard <dev@ibboard.co.uk>
parents:
151
diff
changeset
|
156 statsGrid.Columns[i].Width = COLUMN_WIDTH; |
27
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 |
153
fcd90498d9a2
Re #269: Handle multiple stat lines
IBBoard <dev@ibboard.co.uk>
parents:
151
diff
changeset
|
159 DataGridViewColumn nameColumn = statsGrid.Columns[0]; |
fcd90498d9a2
Re #269: Handle multiple stat lines
IBBoard <dev@ibboard.co.uk>
parents:
151
diff
changeset
|
160 nameColumn.Name = Translation.GetTranslation("UnitName", "Name"); |
fcd90498d9a2
Re #269: Handle multiple stat lines
IBBoard <dev@ibboard.co.uk>
parents:
151
diff
changeset
|
161 nameColumn.Width = statsGrid.ClientSize.Width - (sysStatSlots.Length * (COLUMN_WIDTH + BORDER_WIDTH)); |
151
540c8aa6e565
Re #269: Handle multiple stat lines
IBBoard <dev@ibboard.co.uk>
parents:
150
diff
changeset
|
162 |
540c8aa6e565
Re #269: Handle multiple stat lines
IBBoard <dev@ibboard.co.uk>
parents:
150
diff
changeset
|
163 for (int i = 0; i < statsCount; i++) |
540c8aa6e565
Re #269: Handle multiple stat lines
IBBoard <dev@ibboard.co.uk>
parents:
150
diff
changeset
|
164 { |
540c8aa6e565
Re #269: Handle multiple stat lines
IBBoard <dev@ibboard.co.uk>
parents:
150
diff
changeset
|
165 statsGrid.Columns[i].CellTemplate = new StatsDataGridViewCell(); |
540c8aa6e565
Re #269: Handle multiple stat lines
IBBoard <dev@ibboard.co.uk>
parents:
150
diff
changeset
|
166 } |
540c8aa6e565
Re #269: Handle multiple stat lines
IBBoard <dev@ibboard.co.uk>
parents:
150
diff
changeset
|
167 |
150
0e3837170637
Re #269: Handle multiple stat lines
IBBoard <dev@ibboard.co.uk>
parents:
145
diff
changeset
|
168 return statsGrid; |
0e3837170637
Re #269: Handle multiple stat lines
IBBoard <dev@ibboard.co.uk>
parents:
145
diff
changeset
|
169 } |
0e3837170637
Re #269: Handle multiple stat lines
IBBoard <dev@ibboard.co.uk>
parents:
145
diff
changeset
|
170 |
0e3837170637
Re #269: Handle multiple stat lines
IBBoard <dev@ibboard.co.uk>
parents:
145
diff
changeset
|
171 private static DataColumn CreateDataColumn(string slotName) |
0e3837170637
Re #269: Handle multiple stat lines
IBBoard <dev@ibboard.co.uk>
parents:
145
diff
changeset
|
172 { |
151
540c8aa6e565
Re #269: Handle multiple stat lines
IBBoard <dev@ibboard.co.uk>
parents:
150
diff
changeset
|
173 DataColumn tempCol = new DataColumn(slotName, typeof(Stat)); |
150
0e3837170637
Re #269: Handle multiple stat lines
IBBoard <dev@ibboard.co.uk>
parents:
145
diff
changeset
|
174 return tempCol; |
0e3837170637
Re #269: Handle multiple stat lines
IBBoard <dev@ibboard.co.uk>
parents:
145
diff
changeset
|
175 } |
0e3837170637
Re #269: Handle multiple stat lines
IBBoard <dev@ibboard.co.uk>
parents:
145
diff
changeset
|
176 |
151
540c8aa6e565
Re #269: Handle multiple stat lines
IBBoard <dev@ibboard.co.uk>
parents:
150
diff
changeset
|
177 public DataGridView CreateDataGridView() |
150
0e3837170637
Re #269: Handle multiple stat lines
IBBoard <dev@ibboard.co.uk>
parents:
145
diff
changeset
|
178 { |
151
540c8aa6e565
Re #269: Handle multiple stat lines
IBBoard <dev@ibboard.co.uk>
parents:
150
diff
changeset
|
179 DataGridView statsGrid = new DataGridView(); |
150
0e3837170637
Re #269: Handle multiple stat lines
IBBoard <dev@ibboard.co.uk>
parents:
145
diff
changeset
|
180 statsGrid.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) |
0e3837170637
Re #269: Handle multiple stat lines
IBBoard <dev@ibboard.co.uk>
parents:
145
diff
changeset
|
181 | System.Windows.Forms.AnchorStyles.Right))); |
0e3837170637
Re #269: Handle multiple stat lines
IBBoard <dev@ibboard.co.uk>
parents:
145
diff
changeset
|
182 statsGrid.CausesValidation = false; |
0e3837170637
Re #269: Handle multiple stat lines
IBBoard <dev@ibboard.co.uk>
parents:
145
diff
changeset
|
183 statsGrid.ReadOnly = true; |
0e3837170637
Re #269: Handle multiple stat lines
IBBoard <dev@ibboard.co.uk>
parents:
145
diff
changeset
|
184 statsGrid.RowHeadersVisible = false; |
0e3837170637
Re #269: Handle multiple stat lines
IBBoard <dev@ibboard.co.uk>
parents:
145
diff
changeset
|
185 statsGrid.Size = new System.Drawing.Size(600, 88); |
0e3837170637
Re #269: Handle multiple stat lines
IBBoard <dev@ibboard.co.uk>
parents:
145
diff
changeset
|
186 statsGrid.TabStop = false; |
153
fcd90498d9a2
Re #269: Handle multiple stat lines
IBBoard <dev@ibboard.co.uk>
parents:
151
diff
changeset
|
187 statsGrid.AllowUserToAddRows = false; |
fcd90498d9a2
Re #269: Handle multiple stat lines
IBBoard <dev@ibboard.co.uk>
parents:
151
diff
changeset
|
188 statsGrid.ScrollBars = ScrollBars.None; |
fcd90498d9a2
Re #269: Handle multiple stat lines
IBBoard <dev@ibboard.co.uk>
parents:
151
diff
changeset
|
189 statsGrid.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize; |
fcd90498d9a2
Re #269: Handle multiple stat lines
IBBoard <dev@ibboard.co.uk>
parents:
151
diff
changeset
|
190 statsGrid.BorderStyle = BorderStyle.None; |
fcd90498d9a2
Re #269: Handle multiple stat lines
IBBoard <dev@ibboard.co.uk>
parents:
151
diff
changeset
|
191 statsGrid.BackgroundColor = SystemColors.Control; |
fcd90498d9a2
Re #269: Handle multiple stat lines
IBBoard <dev@ibboard.co.uk>
parents:
151
diff
changeset
|
192 statsGrid.RowsAdded += new DataGridViewRowsAddedEventHandler(statsGrid_RowsAdded); |
150
0e3837170637
Re #269: Handle multiple stat lines
IBBoard <dev@ibboard.co.uk>
parents:
145
diff
changeset
|
193 statsPanel.Controls.Add(statsGrid); |
0e3837170637
Re #269: Handle multiple stat lines
IBBoard <dev@ibboard.co.uk>
parents:
145
diff
changeset
|
194 statsGrid.Width = statsPanel.Width; |
0e3837170637
Re #269: Handle multiple stat lines
IBBoard <dev@ibboard.co.uk>
parents:
145
diff
changeset
|
195 return statsGrid; |
27
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
196 } |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
197 |
153
fcd90498d9a2
Re #269: Handle multiple stat lines
IBBoard <dev@ibboard.co.uk>
parents:
151
diff
changeset
|
198 private void statsGrid_RowsAdded(object sender, DataGridViewRowsAddedEventArgs e) |
fcd90498d9a2
Re #269: Handle multiple stat lines
IBBoard <dev@ibboard.co.uk>
parents:
151
diff
changeset
|
199 { |
fcd90498d9a2
Re #269: Handle multiple stat lines
IBBoard <dev@ibboard.co.uk>
parents:
151
diff
changeset
|
200 if (sender is DataGridView) |
fcd90498d9a2
Re #269: Handle multiple stat lines
IBBoard <dev@ibboard.co.uk>
parents:
151
diff
changeset
|
201 { |
fcd90498d9a2
Re #269: Handle multiple stat lines
IBBoard <dev@ibboard.co.uk>
parents:
151
diff
changeset
|
202 SetGridHeight((DataGridView)sender); |
fcd90498d9a2
Re #269: Handle multiple stat lines
IBBoard <dev@ibboard.co.uk>
parents:
151
diff
changeset
|
203 } |
fcd90498d9a2
Re #269: Handle multiple stat lines
IBBoard <dev@ibboard.co.uk>
parents:
151
diff
changeset
|
204 } |
fcd90498d9a2
Re #269: Handle multiple stat lines
IBBoard <dev@ibboard.co.uk>
parents:
151
diff
changeset
|
205 |
fcd90498d9a2
Re #269: Handle multiple stat lines
IBBoard <dev@ibboard.co.uk>
parents:
151
diff
changeset
|
206 private static void SetGridHeight(DataGridView statsGrid) |
fcd90498d9a2
Re #269: Handle multiple stat lines
IBBoard <dev@ibboard.co.uk>
parents:
151
diff
changeset
|
207 { |
fcd90498d9a2
Re #269: Handle multiple stat lines
IBBoard <dev@ibboard.co.uk>
parents:
151
diff
changeset
|
208 DataGridViewRowCollection rows = statsGrid.Rows; |
fcd90498d9a2
Re #269: Handle multiple stat lines
IBBoard <dev@ibboard.co.uk>
parents:
151
diff
changeset
|
209 statsGrid.Height = statsGrid.Columns[0].HeaderCell.Size.Height + (rows.Count * rows[0].Height); |
fcd90498d9a2
Re #269: Handle multiple stat lines
IBBoard <dev@ibboard.co.uk>
parents:
151
diff
changeset
|
210 } |
fcd90498d9a2
Re #269: Handle multiple stat lines
IBBoard <dev@ibboard.co.uk>
parents:
151
diff
changeset
|
211 |
27
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
212 private void SetWeapons() |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
213 { |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
214 foreach (UnitEquipmentItem item in unit.GetEquipment()) |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
215 { |
60
c283545d2d0b
Re #168: Combine "required" and "optional" equipment boxes
IBBoard <dev@ibboard.co.uk>
parents:
55
diff
changeset
|
216 equipmentList.Items.Add(GetEquipmentChoice(item)); |
27
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
217 } |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
218 } |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
219 |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
220 private UnitEquipmentChoice GetEquipmentChoice(UnitEquipmentItem item) |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
221 { |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
222 UnitEquipmentChoice choice = null; |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
223 equipmentChoices.TryGetValue(item, out choice); |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
224 |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
225 if (choice == null) |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
226 { |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
227 choice = new UnitEquipmentChoice(Unit, item); |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
228 equipmentChoices[item] = choice; |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
229 } |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
230 |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
231 return choice; |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
232 } |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
233 |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
234 /// <summary> |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
235 /// Clean up any resources being used. |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
236 /// </summary> |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
237 protected override void Dispose(bool disposing) |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
238 { |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
239 //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
|
240 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
|
241 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
|
242 |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
243 if (disposing) |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
244 { |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
245 if (components != null) |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
246 { |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
247 components.Dispose(); |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
248 } |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
249 } |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
250 base.Dispose(disposing); |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
251 } |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
252 |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
253 #region Windows Form Designer generated code |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
254 /// <summary> |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
255 /// 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
|
256 /// 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
|
257 /// </summary> |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
258 private void InitializeComponent() |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
259 { |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
260 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
|
261 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
|
262 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
|
263 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
|
264 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
|
265 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
|
266 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
|
267 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
|
268 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
|
269 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
|
270 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
|
271 this.notes = new System.Windows.Forms.TextBox(); |
95
83c259516041
Fixes #196: Add notes and abilities to UI
IBBoard <dev@ibboard.co.uk>
parents:
94
diff
changeset
|
272 this.abilitiesList = new System.Windows.Forms.ListBox(); |
83c259516041
Fixes #196: Add notes and abilities to UI
IBBoard <dev@ibboard.co.uk>
parents:
94
diff
changeset
|
273 this.lblAbilities = new IBBoard.Windows.Forms.IBBLabel(); |
150
0e3837170637
Re #269: Handle multiple stat lines
IBBoard <dev@ibboard.co.uk>
parents:
145
diff
changeset
|
274 this.statsPanel = new System.Windows.Forms.Panel(); |
0e3837170637
Re #269: Handle multiple stat lines
IBBoard <dev@ibboard.co.uk>
parents:
145
diff
changeset
|
275 ((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
|
276 this.SuspendLayout(); |
51
53a18feb2370
* Set anchoring for better handling of resizing dialog
IBBoard <dev@ibboard.co.uk>
parents:
40
diff
changeset
|
277 // |
27
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
278 // tbUnitName |
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 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
|
281 this.tbUnitName.Name = "tbUnitName"; |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
282 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
|
283 this.tbUnitName.TabIndex = 1; |
150
0e3837170637
Re #269: Handle multiple stat lines
IBBoard <dev@ibboard.co.uk>
parents:
145
diff
changeset
|
284 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
|
285 this.tbUnitName.Leave += new System.EventHandler(this.tbUnitName_Leave); |
53a18feb2370
* Set anchoring for better handling of resizing dialog
IBBoard <dev@ibboard.co.uk>
parents:
40
diff
changeset
|
286 // |
27
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
287 // unitSize |
51
53a18feb2370
* Set anchoring for better handling of resizing dialog
IBBoard <dev@ibboard.co.uk>
parents:
40
diff
changeset
|
288 // |
150
0e3837170637
Re #269: Handle multiple stat lines
IBBoard <dev@ibboard.co.uk>
parents:
145
diff
changeset
|
289 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
|
290 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
|
291 this.unitSize.Name = "unitSize"; |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
292 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
|
293 this.unitSize.TabIndex = 1; |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
294 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
|
295 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
|
296 1, |
53a18feb2370
* Set anchoring for better handling of resizing dialog
IBBoard <dev@ibboard.co.uk>
parents:
40
diff
changeset
|
297 0, |
53a18feb2370
* Set anchoring for better handling of resizing dialog
IBBoard <dev@ibboard.co.uk>
parents:
40
diff
changeset
|
298 0, |
53a18feb2370
* Set anchoring for better handling of resizing dialog
IBBoard <dev@ibboard.co.uk>
parents:
40
diff
changeset
|
299 0}); |
53a18feb2370
* Set anchoring for better handling of resizing dialog
IBBoard <dev@ibboard.co.uk>
parents:
40
diff
changeset
|
300 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
|
301 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
|
302 // |
27
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
303 // lblUnitSize |
51
53a18feb2370
* Set anchoring for better handling of resizing dialog
IBBoard <dev@ibboard.co.uk>
parents:
40
diff
changeset
|
304 // |
150
0e3837170637
Re #269: Handle multiple stat lines
IBBoard <dev@ibboard.co.uk>
parents:
145
diff
changeset
|
305 this.lblUnitSize.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); |
138
18d607b0249b
Re #203: Translate to multiple languages
IBBoard <dev@ibboard.co.uk>
parents:
109
diff
changeset
|
306 this.lblUnitSize.Location = new System.Drawing.Point(426, 8); |
27
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
307 this.lblUnitSize.Name = "lblUnitSize"; |
138
18d607b0249b
Re #203: Translate to multiple languages
IBBoard <dev@ibboard.co.uk>
parents:
109
diff
changeset
|
308 this.lblUnitSize.Size = new System.Drawing.Size(98, 23); |
27
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
309 this.lblUnitSize.TabIndex = 0; |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
310 this.lblUnitSize.Text = "unit size"; |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
311 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
|
312 // |
60
c283545d2d0b
Re #168: Combine "required" and "optional" equipment boxes
IBBoard <dev@ibboard.co.uk>
parents:
55
diff
changeset
|
313 // lblEquip |
51
53a18feb2370
* Set anchoring for better handling of resizing dialog
IBBoard <dev@ibboard.co.uk>
parents:
40
diff
changeset
|
314 // |
94
e4a8653b9536
Re #196: Add notes and abilities to UI
IBBoard <dev@ibboard.co.uk>
parents:
85
diff
changeset
|
315 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
|
316 this.lblEquip.Name = "lblEquip"; |
94
e4a8653b9536
Re #196: Add notes and abilities to UI
IBBoard <dev@ibboard.co.uk>
parents:
85
diff
changeset
|
317 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
|
318 this.lblEquip.TabIndex = 3; |
c283545d2d0b
Re #168: Combine "required" and "optional" equipment boxes
IBBoard <dev@ibboard.co.uk>
parents:
55
diff
changeset
|
319 this.lblEquip.Text = "equipment"; |
c283545d2d0b
Re #168: Combine "required" and "optional" equipment boxes
IBBoard <dev@ibboard.co.uk>
parents:
55
diff
changeset
|
320 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
|
321 // |
27
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
322 // bttnAddWeapon |
51
53a18feb2370
* Set anchoring for better handling of resizing dialog
IBBoard <dev@ibboard.co.uk>
parents:
40
diff
changeset
|
323 // |
150
0e3837170637
Re #269: Handle multiple stat lines
IBBoard <dev@ibboard.co.uk>
parents:
145
diff
changeset
|
324 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
|
325 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
|
326 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
|
327 this.bttnAddWeapon.Name = "bttnAddWeapon"; |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
328 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
|
329 this.bttnAddWeapon.TabIndex = 4; |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
330 this.bttnAddWeapon.Text = "add"; |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
331 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
|
332 // |
27
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
333 // bttnRemoveWeapon |
51
53a18feb2370
* Set anchoring for better handling of resizing dialog
IBBoard <dev@ibboard.co.uk>
parents:
40
diff
changeset
|
334 // |
150
0e3837170637
Re #269: Handle multiple stat lines
IBBoard <dev@ibboard.co.uk>
parents:
145
diff
changeset
|
335 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
|
336 this.bttnRemoveWeapon.Enabled = false; |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
337 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
|
338 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
|
339 this.bttnRemoveWeapon.Name = "bttnRemoveWeapon"; |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
340 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
|
341 this.bttnRemoveWeapon.TabIndex = 5; |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
342 this.bttnRemoveWeapon.Text = "remove"; |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
343 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
|
344 // |
60
c283545d2d0b
Re #168: Combine "required" and "optional" equipment boxes
IBBoard <dev@ibboard.co.uk>
parents:
55
diff
changeset
|
345 // equipmentList |
51
53a18feb2370
* Set anchoring for better handling of resizing dialog
IBBoard <dev@ibboard.co.uk>
parents:
40
diff
changeset
|
346 // |
150
0e3837170637
Re #269: Handle multiple stat lines
IBBoard <dev@ibboard.co.uk>
parents:
145
diff
changeset
|
347 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
|
348 | System.Windows.Forms.AnchorStyles.Right))); |
60
c283545d2d0b
Re #168: Combine "required" and "optional" equipment boxes
IBBoard <dev@ibboard.co.uk>
parents:
55
diff
changeset
|
349 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
|
350 this.equipmentList.Name = "equipmentList"; |
c283545d2d0b
Re #168: Combine "required" and "optional" equipment boxes
IBBoard <dev@ibboard.co.uk>
parents:
55
diff
changeset
|
351 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
|
352 this.equipmentList.TabIndex = 6; |
150
0e3837170637
Re #269: Handle multiple stat lines
IBBoard <dev@ibboard.co.uk>
parents:
145
diff
changeset
|
353 this.equipmentList.SelectedIndexChanged += new System.EventHandler(this.equipmentList_SelectedIndexChanged); |
60
c283545d2d0b
Re #168: Combine "required" and "optional" equipment boxes
IBBoard <dev@ibboard.co.uk>
parents:
55
diff
changeset
|
354 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
|
355 // |
c283545d2d0b
Re #168: Combine "required" and "optional" equipment boxes
IBBoard <dev@ibboard.co.uk>
parents:
55
diff
changeset
|
356 // bttnReplaceWeapon |
c283545d2d0b
Re #168: Combine "required" and "optional" equipment boxes
IBBoard <dev@ibboard.co.uk>
parents:
55
diff
changeset
|
357 // |
150
0e3837170637
Re #269: Handle multiple stat lines
IBBoard <dev@ibboard.co.uk>
parents:
145
diff
changeset
|
358 this.bttnReplaceWeapon.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); |
60
c283545d2d0b
Re #168: Combine "required" and "optional" equipment boxes
IBBoard <dev@ibboard.co.uk>
parents:
55
diff
changeset
|
359 this.bttnReplaceWeapon.Enabled = false; |
c283545d2d0b
Re #168: Combine "required" and "optional" equipment boxes
IBBoard <dev@ibboard.co.uk>
parents:
55
diff
changeset
|
360 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
|
361 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
|
362 this.bttnReplaceWeapon.Name = "bttnReplaceWeapon"; |
c283545d2d0b
Re #168: Combine "required" and "optional" equipment boxes
IBBoard <dev@ibboard.co.uk>
parents:
55
diff
changeset
|
363 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
|
364 this.bttnReplaceWeapon.TabIndex = 10; |
c283545d2d0b
Re #168: Combine "required" and "optional" equipment boxes
IBBoard <dev@ibboard.co.uk>
parents:
55
diff
changeset
|
365 this.bttnReplaceWeapon.Text = "replace"; |
c283545d2d0b
Re #168: Combine "required" and "optional" equipment boxes
IBBoard <dev@ibboard.co.uk>
parents:
55
diff
changeset
|
366 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
|
367 // |
27
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
368 // bttnEditWeapon |
51
53a18feb2370
* Set anchoring for better handling of resizing dialog
IBBoard <dev@ibboard.co.uk>
parents:
40
diff
changeset
|
369 // |
150
0e3837170637
Re #269: Handle multiple stat lines
IBBoard <dev@ibboard.co.uk>
parents:
145
diff
changeset
|
370 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
|
371 this.bttnEditWeapon.Enabled = false; |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
372 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
|
373 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
|
374 this.bttnEditWeapon.Name = "bttnEditWeapon"; |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
375 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
|
376 this.bttnEditWeapon.TabIndex = 11; |
27
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
377 this.bttnEditWeapon.Text = "edit"; |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
378 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
|
379 // |
53
e6d0d9eababf
Fixes #163: Show unit cost on unit dialog
IBBoard <dev@ibboard.co.uk>
parents:
52
diff
changeset
|
380 // lblPoints |
e6d0d9eababf
Fixes #163: Show unit cost on unit dialog
IBBoard <dev@ibboard.co.uk>
parents:
52
diff
changeset
|
381 // |
e6d0d9eababf
Fixes #163: Show unit cost on unit dialog
IBBoard <dev@ibboard.co.uk>
parents:
52
diff
changeset
|
382 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
|
383 this.lblPoints.Name = "lblPoints"; |
138
18d607b0249b
Re #203: Translate to multiple languages
IBBoard <dev@ibboard.co.uk>
parents:
109
diff
changeset
|
384 this.lblPoints.Size = new System.Drawing.Size(77, 21); |
53
e6d0d9eababf
Fixes #163: Show unit cost on unit dialog
IBBoard <dev@ibboard.co.uk>
parents:
52
diff
changeset
|
385 this.lblPoints.TabIndex = 12; |
60
c283545d2d0b
Re #168: Combine "required" and "optional" equipment boxes
IBBoard <dev@ibboard.co.uk>
parents:
55
diff
changeset
|
386 this.lblPoints.Text = "(points)"; |
53
e6d0d9eababf
Fixes #163: Show unit cost on unit dialog
IBBoard <dev@ibboard.co.uk>
parents:
52
diff
changeset
|
387 // |
94
e4a8653b9536
Re #196: Add notes and abilities to UI
IBBoard <dev@ibboard.co.uk>
parents:
85
diff
changeset
|
388 // lblNotes |
e4a8653b9536
Re #196: Add notes and abilities to UI
IBBoard <dev@ibboard.co.uk>
parents:
85
diff
changeset
|
389 // |
95
83c259516041
Fixes #196: Add notes and abilities to UI
IBBoard <dev@ibboard.co.uk>
parents:
94
diff
changeset
|
390 this.lblNotes.Location = new System.Drawing.Point(13, 317); |
94
e4a8653b9536
Re #196: Add notes and abilities to UI
IBBoard <dev@ibboard.co.uk>
parents:
85
diff
changeset
|
391 this.lblNotes.Name = "lblNotes"; |
e4a8653b9536
Re #196: Add notes and abilities to UI
IBBoard <dev@ibboard.co.uk>
parents:
85
diff
changeset
|
392 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
|
393 this.lblNotes.TabIndex = 13; |
e4a8653b9536
Re #196: Add notes and abilities to UI
IBBoard <dev@ibboard.co.uk>
parents:
85
diff
changeset
|
394 this.lblNotes.Text = "notes"; |
e4a8653b9536
Re #196: Add notes and abilities to UI
IBBoard <dev@ibboard.co.uk>
parents:
85
diff
changeset
|
395 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
|
396 // |
e4a8653b9536
Re #196: Add notes and abilities to UI
IBBoard <dev@ibboard.co.uk>
parents:
85
diff
changeset
|
397 // notes |
e4a8653b9536
Re #196: Add notes and abilities to UI
IBBoard <dev@ibboard.co.uk>
parents:
85
diff
changeset
|
398 // |
95
83c259516041
Fixes #196: Add notes and abilities to UI
IBBoard <dev@ibboard.co.uk>
parents:
94
diff
changeset
|
399 this.notes.Location = new System.Drawing.Point(102, 317); |
94
e4a8653b9536
Re #196: Add notes and abilities to UI
IBBoard <dev@ibboard.co.uk>
parents:
85
diff
changeset
|
400 this.notes.Multiline = true; |
e4a8653b9536
Re #196: Add notes and abilities to UI
IBBoard <dev@ibboard.co.uk>
parents:
85
diff
changeset
|
401 this.notes.Name = "notes"; |
e4a8653b9536
Re #196: Add notes and abilities to UI
IBBoard <dev@ibboard.co.uk>
parents:
85
diff
changeset
|
402 this.notes.ReadOnly = true; |
95
83c259516041
Fixes #196: Add notes and abilities to UI
IBBoard <dev@ibboard.co.uk>
parents:
94
diff
changeset
|
403 this.notes.Size = new System.Drawing.Size(408, 62); |
94
e4a8653b9536
Re #196: Add notes and abilities to UI
IBBoard <dev@ibboard.co.uk>
parents:
85
diff
changeset
|
404 this.notes.TabIndex = 14; |
e4a8653b9536
Re #196: Add notes and abilities to UI
IBBoard <dev@ibboard.co.uk>
parents:
85
diff
changeset
|
405 // |
95
83c259516041
Fixes #196: Add notes and abilities to UI
IBBoard <dev@ibboard.co.uk>
parents:
94
diff
changeset
|
406 // abilitiesList |
83c259516041
Fixes #196: Add notes and abilities to UI
IBBoard <dev@ibboard.co.uk>
parents:
94
diff
changeset
|
407 // |
83c259516041
Fixes #196: Add notes and abilities to UI
IBBoard <dev@ibboard.co.uk>
parents:
94
diff
changeset
|
408 this.abilitiesList.FormattingEnabled = true; |
83c259516041
Fixes #196: Add notes and abilities to UI
IBBoard <dev@ibboard.co.uk>
parents:
94
diff
changeset
|
409 this.abilitiesList.Location = new System.Drawing.Point(102, 240); |
83c259516041
Fixes #196: Add notes and abilities to UI
IBBoard <dev@ibboard.co.uk>
parents:
94
diff
changeset
|
410 this.abilitiesList.Name = "abilitiesList"; |
83c259516041
Fixes #196: Add notes and abilities to UI
IBBoard <dev@ibboard.co.uk>
parents:
94
diff
changeset
|
411 this.abilitiesList.Size = new System.Drawing.Size(408, 69); |
83c259516041
Fixes #196: Add notes and abilities to UI
IBBoard <dev@ibboard.co.uk>
parents:
94
diff
changeset
|
412 this.abilitiesList.TabIndex = 15; |
83c259516041
Fixes #196: Add notes and abilities to UI
IBBoard <dev@ibboard.co.uk>
parents:
94
diff
changeset
|
413 // |
83c259516041
Fixes #196: Add notes and abilities to UI
IBBoard <dev@ibboard.co.uk>
parents:
94
diff
changeset
|
414 // lblAbilities |
83c259516041
Fixes #196: Add notes and abilities to UI
IBBoard <dev@ibboard.co.uk>
parents:
94
diff
changeset
|
415 // |
83c259516041
Fixes #196: Add notes and abilities to UI
IBBoard <dev@ibboard.co.uk>
parents:
94
diff
changeset
|
416 this.lblAbilities.Location = new System.Drawing.Point(13, 240); |
83c259516041
Fixes #196: Add notes and abilities to UI
IBBoard <dev@ibboard.co.uk>
parents:
94
diff
changeset
|
417 this.lblAbilities.Name = "lblAbilities"; |
83c259516041
Fixes #196: Add notes and abilities to UI
IBBoard <dev@ibboard.co.uk>
parents:
94
diff
changeset
|
418 this.lblAbilities.Size = new System.Drawing.Size(84, 62); |
83c259516041
Fixes #196: Add notes and abilities to UI
IBBoard <dev@ibboard.co.uk>
parents:
94
diff
changeset
|
419 this.lblAbilities.TabIndex = 16; |
83c259516041
Fixes #196: Add notes and abilities to UI
IBBoard <dev@ibboard.co.uk>
parents:
94
diff
changeset
|
420 this.lblAbilities.Text = "abilities"; |
83c259516041
Fixes #196: Add notes and abilities to UI
IBBoard <dev@ibboard.co.uk>
parents:
94
diff
changeset
|
421 this.lblAbilities.TextAlign = System.Drawing.ContentAlignment.TopRight; |
83c259516041
Fixes #196: Add notes and abilities to UI
IBBoard <dev@ibboard.co.uk>
parents:
94
diff
changeset
|
422 // |
150
0e3837170637
Re #269: Handle multiple stat lines
IBBoard <dev@ibboard.co.uk>
parents:
145
diff
changeset
|
423 // statsPanel |
0e3837170637
Re #269: Handle multiple stat lines
IBBoard <dev@ibboard.co.uk>
parents:
145
diff
changeset
|
424 // |
0e3837170637
Re #269: Handle multiple stat lines
IBBoard <dev@ibboard.co.uk>
parents:
145
diff
changeset
|
425 this.statsPanel.AutoScroll = true; |
0e3837170637
Re #269: Handle multiple stat lines
IBBoard <dev@ibboard.co.uk>
parents:
145
diff
changeset
|
426 this.statsPanel.Location = new System.Drawing.Point(8, 35); |
0e3837170637
Re #269: Handle multiple stat lines
IBBoard <dev@ibboard.co.uk>
parents:
145
diff
changeset
|
427 this.statsPanel.Name = "statsPanel"; |
0e3837170637
Re #269: Handle multiple stat lines
IBBoard <dev@ibboard.co.uk>
parents:
145
diff
changeset
|
428 this.statsPanel.Size = new System.Drawing.Size(600, 85); |
0e3837170637
Re #269: Handle multiple stat lines
IBBoard <dev@ibboard.co.uk>
parents:
145
diff
changeset
|
429 this.statsPanel.TabIndex = 17; |
0e3837170637
Re #269: Handle multiple stat lines
IBBoard <dev@ibboard.co.uk>
parents:
145
diff
changeset
|
430 // |
27
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
431 // FrmUnit |
51
53a18feb2370
* Set anchoring for better handling of resizing dialog
IBBoard <dev@ibboard.co.uk>
parents:
40
diff
changeset
|
432 // |
27
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
433 this.AutoScaleBaseSize = new System.Drawing.Size(5, 13); |
95
83c259516041
Fixes #196: Add notes and abilities to UI
IBBoard <dev@ibboard.co.uk>
parents:
94
diff
changeset
|
434 this.ClientSize = new System.Drawing.Size(616, 391); |
150
0e3837170637
Re #269: Handle multiple stat lines
IBBoard <dev@ibboard.co.uk>
parents:
145
diff
changeset
|
435 this.Controls.Add(this.statsPanel); |
95
83c259516041
Fixes #196: Add notes and abilities to UI
IBBoard <dev@ibboard.co.uk>
parents:
94
diff
changeset
|
436 this.Controls.Add(this.lblAbilities); |
83c259516041
Fixes #196: Add notes and abilities to UI
IBBoard <dev@ibboard.co.uk>
parents:
94
diff
changeset
|
437 this.Controls.Add(this.abilitiesList); |
94
e4a8653b9536
Re #196: Add notes and abilities to UI
IBBoard <dev@ibboard.co.uk>
parents:
85
diff
changeset
|
438 this.Controls.Add(this.notes); |
e4a8653b9536
Re #196: Add notes and abilities to UI
IBBoard <dev@ibboard.co.uk>
parents:
85
diff
changeset
|
439 this.Controls.Add(this.lblNotes); |
53
e6d0d9eababf
Fixes #163: Show unit cost on unit dialog
IBBoard <dev@ibboard.co.uk>
parents:
52
diff
changeset
|
440 this.Controls.Add(this.lblPoints); |
60
c283545d2d0b
Re #168: Combine "required" and "optional" equipment boxes
IBBoard <dev@ibboard.co.uk>
parents:
55
diff
changeset
|
441 this.Controls.Add(this.bttnEditWeapon); |
27
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
442 this.Controls.Add(this.bttnReplaceWeapon); |
60
c283545d2d0b
Re #168: Combine "required" and "optional" equipment boxes
IBBoard <dev@ibboard.co.uk>
parents:
55
diff
changeset
|
443 this.Controls.Add(this.equipmentList); |
27
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
444 this.Controls.Add(this.bttnRemoveWeapon); |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
445 this.Controls.Add(this.bttnAddWeapon); |
60
c283545d2d0b
Re #168: Combine "required" and "optional" equipment boxes
IBBoard <dev@ibboard.co.uk>
parents:
55
diff
changeset
|
446 this.Controls.Add(this.lblEquip); |
27
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
447 this.Controls.Add(this.lblUnitSize); |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
448 this.Controls.Add(this.unitSize); |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
449 this.Controls.Add(this.tbUnitName); |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
450 this.Name = "FrmUnit"; |
84
1e85a0687e4d
Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents:
72
diff
changeset
|
451 this.ShowIcon = false; |
27
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
452 this.ShowInTaskbar = false; |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
453 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
|
454 this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.FrmUnit_FormClosing); |
150
0e3837170637
Re #269: Handle multiple stat lines
IBBoard <dev@ibboard.co.uk>
parents:
145
diff
changeset
|
455 ((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
|
456 this.ResumeLayout(false); |
51
53a18feb2370
* Set anchoring for better handling of resizing dialog
IBBoard <dev@ibboard.co.uk>
parents:
40
diff
changeset
|
457 this.PerformLayout(); |
27
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
458 |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
459 } |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
460 #endregion |
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 public Unit Unit |
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 get { return unit; } |
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 |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
467 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
|
468 { |
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
|
469 UpdateUnitName(); |
27
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
470 } |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
471 |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
472 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
|
473 { |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
474 if (e.KeyCode == Keys.Enter) |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
475 { |
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
|
476 UpdateUnitName(); |
27
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
477 } |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
478 } |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
479 |
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
|
480 private void UpdateUnitName() |
27
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
481 { |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
482 if (unit.Name != tbUnitName.Text) |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
483 { |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
484 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
|
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 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
|
489 { |
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
|
490 UpdateUnitSize(); |
27
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
491 } |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
492 |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
493 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
|
494 { |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
495 if (e.KeyCode == Keys.Enter) |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
496 { |
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
|
497 UpdateUnitSize(); |
27
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
498 } |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
499 } |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
500 |
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
|
501 private void UpdateUnitSize() |
27
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
502 { |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
503 if (unit.Size != unitSize.Value) |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
504 { |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
505 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
|
506 } |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
507 } |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
508 |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
509 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
|
510 { |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
511 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
|
512 { |
153
fcd90498d9a2
Re #269: Handle multiple stat lines
IBBoard <dev@ibboard.co.uk>
parents:
151
diff
changeset
|
513 SetUnitName(); |
27
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
514 } |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
515 } |
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 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
|
518 { |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
519 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
|
520 { |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
521 unitSize.Value = newValue; |
145
51463bc1fb21
Fixes #265: Add language preference UI
IBBoard <dev@ibboard.co.uk>
parents:
143
diff
changeset
|
522 RefreshUnitEquipment(); |
51463bc1fb21
Fixes #265: Add language preference UI
IBBoard <dev@ibboard.co.uk>
parents:
143
diff
changeset
|
523 } |
51463bc1fb21
Fixes #265: Add language preference UI
IBBoard <dev@ibboard.co.uk>
parents:
143
diff
changeset
|
524 } |
51463bc1fb21
Fixes #265: Add language preference UI
IBBoard <dev@ibboard.co.uk>
parents:
143
diff
changeset
|
525 |
51463bc1fb21
Fixes #265: Add language preference UI
IBBoard <dev@ibboard.co.uk>
parents:
143
diff
changeset
|
526 private void RefreshUnitEquipment() |
51463bc1fb21
Fixes #265: Add language preference UI
IBBoard <dev@ibboard.co.uk>
parents:
143
diff
changeset
|
527 { |
51463bc1fb21
Fixes #265: Add language preference UI
IBBoard <dev@ibboard.co.uk>
parents:
143
diff
changeset
|
528 foreach (UnitEquipmentChoice choice in equipmentChoices.Values) |
51463bc1fb21
Fixes #265: Add language preference UI
IBBoard <dev@ibboard.co.uk>
parents:
143
diff
changeset
|
529 { |
51463bc1fb21
Fixes #265: Add language preference UI
IBBoard <dev@ibboard.co.uk>
parents:
143
diff
changeset
|
530 SetEquipmentListValue(choice); |
27
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
531 } |
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 |
60
c283545d2d0b
Re #168: Combine "required" and "optional" equipment boxes
IBBoard <dev@ibboard.co.uk>
parents:
55
diff
changeset
|
534 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
|
535 { |
60
c283545d2d0b
Re #168: Combine "required" and "optional" equipment boxes
IBBoard <dev@ibboard.co.uk>
parents:
55
diff
changeset
|
536 SetButtonsEnabledState(); |
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 SetButtonsEnabledState() |
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 |
c283545d2d0b
Re #168: Combine "required" and "optional" equipment boxes
IBBoard <dev@ibboard.co.uk>
parents:
55
diff
changeset
|
542 UnitEquipmentItem equipItem = GetSelectedUnitEquipmentItem(); |
c283545d2d0b
Re #168: Combine "required" and "optional" equipment boxes
IBBoard <dev@ibboard.co.uk>
parents:
55
diff
changeset
|
543 bttnReplaceWeapon.Enabled = (equipItem != null && equipItem.HasAlternatives()); |
c283545d2d0b
Re #168: Combine "required" and "optional" equipment boxes
IBBoard <dev@ibboard.co.uk>
parents:
55
diff
changeset
|
544 bttnEditWeapon.Enabled = (equipItem != null); |
c283545d2d0b
Re #168: Combine "required" and "optional" equipment boxes
IBBoard <dev@ibboard.co.uk>
parents:
55
diff
changeset
|
545 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
|
546 } |
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 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
|
549 { |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
550 if (obj is UnitEquipmentItem) |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
551 { |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
552 UnitEquipmentItem equip = (UnitEquipmentItem) obj; |
60
c283545d2d0b
Re #168: Combine "required" and "optional" equipment boxes
IBBoard <dev@ibboard.co.uk>
parents:
55
diff
changeset
|
553 UnitEquipmentChoice equipChoice = GetEquipmentChoice(equip); |
27
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
554 |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
555 if (newValue == 0) |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
556 { |
60
c283545d2d0b
Re #168: Combine "required" and "optional" equipment boxes
IBBoard <dev@ibboard.co.uk>
parents:
55
diff
changeset
|
557 equipmentList.Items.Remove(equipChoice); |
27
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
558 } |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
559 else |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
560 { |
109
f4d3e64bdb18
Fixes #221: Changing unit size doesn't update text of equipment items
IBBoard <dev@ibboard.co.uk>
parents:
95
diff
changeset
|
561 SetEquipmentListValue(equipChoice); |
f4d3e64bdb18
Fixes #221: Changing unit size doesn't update text of equipment items
IBBoard <dev@ibboard.co.uk>
parents:
95
diff
changeset
|
562 } |
f4d3e64bdb18
Fixes #221: Changing unit size doesn't update text of equipment items
IBBoard <dev@ibboard.co.uk>
parents:
95
diff
changeset
|
563 } |
f4d3e64bdb18
Fixes #221: Changing unit size doesn't update text of equipment items
IBBoard <dev@ibboard.co.uk>
parents:
95
diff
changeset
|
564 } |
27
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
565 |
109
f4d3e64bdb18
Fixes #221: Changing unit size doesn't update text of equipment items
IBBoard <dev@ibboard.co.uk>
parents:
95
diff
changeset
|
566 private void SetEquipmentListValue(UnitEquipmentChoice equipChoice) |
f4d3e64bdb18
Fixes #221: Changing unit size doesn't update text of equipment items
IBBoard <dev@ibboard.co.uk>
parents:
95
diff
changeset
|
567 { |
f4d3e64bdb18
Fixes #221: Changing unit size doesn't update text of equipment items
IBBoard <dev@ibboard.co.uk>
parents:
95
diff
changeset
|
568 int idx = equipmentList.Items.IndexOf(equipChoice); |
f4d3e64bdb18
Fixes #221: Changing unit size doesn't update text of equipment items
IBBoard <dev@ibboard.co.uk>
parents:
95
diff
changeset
|
569 |
f4d3e64bdb18
Fixes #221: Changing unit size doesn't update text of equipment items
IBBoard <dev@ibboard.co.uk>
parents:
95
diff
changeset
|
570 if (idx > -1) |
f4d3e64bdb18
Fixes #221: Changing unit size doesn't update text of equipment items
IBBoard <dev@ibboard.co.uk>
parents:
95
diff
changeset
|
571 { |
f4d3e64bdb18
Fixes #221: Changing unit size doesn't update text of equipment items
IBBoard <dev@ibboard.co.uk>
parents:
95
diff
changeset
|
572 equipmentList.Items[idx] = equipChoice; |
f4d3e64bdb18
Fixes #221: Changing unit size doesn't update text of equipment items
IBBoard <dev@ibboard.co.uk>
parents:
95
diff
changeset
|
573 } |
f4d3e64bdb18
Fixes #221: Changing unit size doesn't update text of equipment items
IBBoard <dev@ibboard.co.uk>
parents:
95
diff
changeset
|
574 else |
f4d3e64bdb18
Fixes #221: Changing unit size doesn't update text of equipment items
IBBoard <dev@ibboard.co.uk>
parents:
95
diff
changeset
|
575 { |
f4d3e64bdb18
Fixes #221: Changing unit size doesn't update text of equipment items
IBBoard <dev@ibboard.co.uk>
parents:
95
diff
changeset
|
576 equipmentList.Items.Add(equipChoice); |
27
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
577 } |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
578 } |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
579 |
60
c283545d2d0b
Re #168: Combine "required" and "optional" equipment boxes
IBBoard <dev@ibboard.co.uk>
parents:
55
diff
changeset
|
580 private void EditWeapon() |
c283545d2d0b
Re #168: Combine "required" and "optional" equipment boxes
IBBoard <dev@ibboard.co.uk>
parents:
55
diff
changeset
|
581 { |
72
9a215113c84c
Re #184: Unhandled exception in the unit form
IBBoard <dev@ibboard.co.uk>
parents:
62
diff
changeset
|
582 UnitEquipmentItem item = GetSelectedUnitEquipmentItem(); |
9a215113c84c
Re #184: Unhandled exception in the unit form
IBBoard <dev@ibboard.co.uk>
parents:
62
diff
changeset
|
583 |
9a215113c84c
Re #184: Unhandled exception in the unit form
IBBoard <dev@ibboard.co.uk>
parents:
62
diff
changeset
|
584 if (item != null) |
9a215113c84c
Re #184: Unhandled exception in the unit form
IBBoard <dev@ibboard.co.uk>
parents:
62
diff
changeset
|
585 { |
9a215113c84c
Re #184: Unhandled exception in the unit form
IBBoard <dev@ibboard.co.uk>
parents:
62
diff
changeset
|
586 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
|
587 editEquip.ShowDialog(this); |
9a215113c84c
Re #184: Unhandled exception in the unit form
IBBoard <dev@ibboard.co.uk>
parents:
62
diff
changeset
|
588 } |
60
c283545d2d0b
Re #168: Combine "required" and "optional" equipment boxes
IBBoard <dev@ibboard.co.uk>
parents:
55
diff
changeset
|
589 } |
c283545d2d0b
Re #168: Combine "required" and "optional" equipment boxes
IBBoard <dev@ibboard.co.uk>
parents:
55
diff
changeset
|
590 |
c283545d2d0b
Re #168: Combine "required" and "optional" equipment boxes
IBBoard <dev@ibboard.co.uk>
parents:
55
diff
changeset
|
591 private UnitEquipmentItem GetSelectedUnitEquipmentItem() |
27
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
592 { |
60
c283545d2d0b
Re #168: Combine "required" and "optional" equipment boxes
IBBoard <dev@ibboard.co.uk>
parents:
55
diff
changeset
|
593 UnitEquipmentChoice selectedItem = GetSelectedUnitEquipmentChoice(); |
c283545d2d0b
Re #168: Combine "required" and "optional" equipment boxes
IBBoard <dev@ibboard.co.uk>
parents:
55
diff
changeset
|
594 UnitEquipmentItem equipItem = null; |
c283545d2d0b
Re #168: Combine "required" and "optional" equipment boxes
IBBoard <dev@ibboard.co.uk>
parents:
55
diff
changeset
|
595 |
c283545d2d0b
Re #168: Combine "required" and "optional" equipment boxes
IBBoard <dev@ibboard.co.uk>
parents:
55
diff
changeset
|
596 if (selectedItem!=null) |
c283545d2d0b
Re #168: Combine "required" and "optional" equipment boxes
IBBoard <dev@ibboard.co.uk>
parents:
55
diff
changeset
|
597 { |
c283545d2d0b
Re #168: Combine "required" and "optional" equipment boxes
IBBoard <dev@ibboard.co.uk>
parents:
55
diff
changeset
|
598 equipItem = selectedItem.Item; |
c283545d2d0b
Re #168: Combine "required" and "optional" equipment boxes
IBBoard <dev@ibboard.co.uk>
parents:
55
diff
changeset
|
599 } |
c283545d2d0b
Re #168: Combine "required" and "optional" equipment boxes
IBBoard <dev@ibboard.co.uk>
parents:
55
diff
changeset
|
600 |
c283545d2d0b
Re #168: Combine "required" and "optional" equipment boxes
IBBoard <dev@ibboard.co.uk>
parents:
55
diff
changeset
|
601 return equipItem; |
c283545d2d0b
Re #168: Combine "required" and "optional" equipment boxes
IBBoard <dev@ibboard.co.uk>
parents:
55
diff
changeset
|
602 } |
c283545d2d0b
Re #168: Combine "required" and "optional" equipment boxes
IBBoard <dev@ibboard.co.uk>
parents:
55
diff
changeset
|
603 |
c283545d2d0b
Re #168: Combine "required" and "optional" equipment boxes
IBBoard <dev@ibboard.co.uk>
parents:
55
diff
changeset
|
604 private UnitEquipmentChoice GetSelectedUnitEquipmentChoice() |
c283545d2d0b
Re #168: Combine "required" and "optional" equipment boxes
IBBoard <dev@ibboard.co.uk>
parents:
55
diff
changeset
|
605 { |
c283545d2d0b
Re #168: Combine "required" and "optional" equipment boxes
IBBoard <dev@ibboard.co.uk>
parents:
55
diff
changeset
|
606 return (UnitEquipmentChoice) equipmentList.SelectedItem; |
27
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
607 } |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
608 |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
609 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
|
610 { |
60
c283545d2d0b
Re #168: Combine "required" and "optional" equipment boxes
IBBoard <dev@ibboard.co.uk>
parents:
55
diff
changeset
|
611 EditWeapon(); |
27
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
612 } |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
613 |
60
c283545d2d0b
Re #168: Combine "required" and "optional" equipment boxes
IBBoard <dev@ibboard.co.uk>
parents:
55
diff
changeset
|
614 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
|
615 { |
60
c283545d2d0b
Re #168: Combine "required" and "optional" equipment boxes
IBBoard <dev@ibboard.co.uk>
parents:
55
diff
changeset
|
616 EditWeapon(); |
27
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
617 } |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
618 |
60
c283545d2d0b
Re #168: Combine "required" and "optional" equipment boxes
IBBoard <dev@ibboard.co.uk>
parents:
55
diff
changeset
|
619 private void AddWeapon() |
27
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
620 { |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
621 FrmNewUnitEquipment newEquip = new FrmNewUnitEquipment(Unit, commandStack); |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
622 newEquip.ShowDialog(this); |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
623 } |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
624 |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
625 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
|
626 { |
60
c283545d2d0b
Re #168: Combine "required" and "optional" equipment boxes
IBBoard <dev@ibboard.co.uk>
parents:
55
diff
changeset
|
627 AddWeapon(); |
27
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
628 } |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
629 |
60
c283545d2d0b
Re #168: Combine "required" and "optional" equipment boxes
IBBoard <dev@ibboard.co.uk>
parents:
55
diff
changeset
|
630 private void RemoveWeapon() |
27
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
631 { |
60
c283545d2d0b
Re #168: Combine "required" and "optional" equipment boxes
IBBoard <dev@ibboard.co.uk>
parents:
55
diff
changeset
|
632 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
|
633 } |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
634 |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
635 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
|
636 { |
60
c283545d2d0b
Re #168: Combine "required" and "optional" equipment boxes
IBBoard <dev@ibboard.co.uk>
parents:
55
diff
changeset
|
637 RemoveWeapon(); |
27
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
638 } |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
639 |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
640 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
|
641 { |
60
c283545d2d0b
Re #168: Combine "required" and "optional" equipment boxes
IBBoard <dev@ibboard.co.uk>
parents:
55
diff
changeset
|
642 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
|
643 replace.ShowDialog(this); |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
644 } |
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
|
645 |
4a56900936aa
Fixes #165: Closing unit dialog that has unit name/size changes loses the changes
IBBoard <dev@ibboard.co.uk>
parents:
51
diff
changeset
|
646 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
|
647 { |
4a56900936aa
Fixes #165: Closing unit dialog that has unit name/size changes loses the changes
IBBoard <dev@ibboard.co.uk>
parents:
51
diff
changeset
|
648 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
|
649 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
|
650 } |
27
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
651 } |
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
652 } |