Mercurial > repos > IBDev-IBBoard.WarFoundry.GUI.WinForms
annotate FrmUnit.cs @ 190:1ca23c47345a
Re #327: Point names used in the GUI
author | snowblizz |
---|---|
date | Mon, 24 Jan 2011 16:50:31 +0000 |
parents | 97fd4b6f823b |
children | eaa7b639d390 |
rev | line source |
---|---|
166
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
1 // This file (FrmUnit.cs) is a part of the IBBoard.WarFoundry.GUI.WinForms project and is copyright 2007, 2008, 2009 IBBoard. |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
2 // |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
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. |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
4 |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
5 using System; |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
6 using System.Drawing; |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
7 using System.Data; |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
8 using System.Collections.Generic; |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
9 using System.ComponentModel; |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
10 using System.Windows.Forms; |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
11 using IBBoard.Commands; |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
12 using IBBoard.Lang; |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
13 using IBBoard.Windows.Forms; |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
14 using IBBoard.Windows.Forms.I18N; |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
15 using IBBoard.WarFoundry.API; |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
16 using IBBoard.WarFoundry.API.Commands; |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
17 using IBBoard.WarFoundry.API.Objects; |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
18 using IBBoard.WarFoundry.GUI.WinForms.UI; |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
19 using IBBoard.WarFoundry.GUI.WinForms.Util; |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
20 using log4net; |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
21 |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
22 namespace IBBoard.WarFoundry.GUI.WinForms |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
23 { |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
24 /// <summary> |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
25 /// Summary description for FrmUnit. |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
26 /// </summary> |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
27 public class FrmUnit : IBBoard.Windows.Forms.IBBForm |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
28 { |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
29 private static readonly ILog log = LogManager.GetLogger(typeof(FrmUnit)); |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
30 private static readonly int BORDER_WIDTH = 1; |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
31 private static readonly int NAME_COL_WIDTH_MULTIPLIER = 3; |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
32 private Unit unit; |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
33 private Dictionary<UnitEquipmentItem, UnitEquipmentChoice> equipmentChoices = new Dictionary<UnitEquipmentItem, UnitEquipmentChoice>(); |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
34 private Dictionary<string, DataGridView> DataGridViews = new Dictionary<string, DataGridView>(); |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
35 private CommandStack commandStack; |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
36 private System.Windows.Forms.TextBox tbUnitName; |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
37 private System.Windows.Forms.NumericUpDown unitSize; |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
38 private IBBLabel lblUnitSize; |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
39 private IBBButton bttnAddWeapon; |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
40 private IBBButton bttnRemoveWeapon; |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
41 private IBBLabel lblEquip; |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
42 private System.Windows.Forms.ListBox equipmentList; |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
43 private IBBButton bttnReplaceWeapon; |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
44 private IBBButton bttnEditWeapon; |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
45 private Label lblPoints; |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
46 private IBBLabel lblNotes; |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
47 private TextBox notes; |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
48 private ListBox abilitiesList; |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
49 private IBBLabel lblAbilities; |
190 | 50 private FlowLayoutPanel statsPanel; |
51 public GameSystem CurrentGameSystem | |
52 { | |
53 get { return WarFoundryCore.CurrentGameSystem; } | |
54 set { WarFoundryCore.CurrentGameSystem = value; } | |
55 } | |
56 | |
166
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
57 /// <summary> |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
58 /// Required designer variable. |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
59 /// </summary> |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
60 private System.ComponentModel.Container components = null; |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
61 |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
62 public FrmUnit(Unit toDisplay, CommandStack cmdStack) |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
63 { |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
64 unit = toDisplay; |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
65 commandStack = cmdStack; |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
66 // |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
67 // Required for Windows Form Designer support |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
68 // |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
69 InitializeComponent(); |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
70 TranslateForm(); |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
71 Translation.TranslationChanged += new MethodInvoker(TranslateForm); |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
72 unit.NameChanged += new StringValChangedDelegate(unit_NameChanged); |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
73 unit.UnitSizeChanged += new IntValChangedDelegate(unit_UnitSizeChanged); |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
74 unit.UnitEquipmentAmountChanged += new DoubleValChangedDelegate(unit_UnitEquipmentAmountChanged); |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
75 unit.PointsValueChanged += new DoubleValChangedDelegate(unit_PointsValueChanged); |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
76 |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
77 unitSize.Value = unit.Size; |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
78 unitSize.Maximum = (unit.UnitType.MaxSize == WarFoundryCore.INFINITY ? int.MaxValue : unit.UnitType.MaxSize); |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
79 unitSize.Minimum = unit.UnitType.MinSize; |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
80 unitSize.Enabled = (unitSize.Maximum != unitSize.Minimum); |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
81 |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
82 notes.Text = unit.UnitType.Notes; |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
83 abilitiesList.DataSource = new List<Ability>(unit.UnitType.GetRequiredAbilities()); |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
84 abilitiesList.DisplayMember = "Name"; |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
85 SetPointsValueText(); |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
86 SetStats(); |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
87 SetWeapons(); |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
88 } |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
89 |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
90 private void TranslateForm() |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
91 { |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
92 ControlTranslator.TranslateControl(this); |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
93 SetUnitName(); |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
94 RefreshUnitEquipment(); |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
95 } |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
96 |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
97 private void SetUnitName() |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
98 { |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
99 tbUnitName.Text = unit.Name; |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
100 Text = Translation.GetTranslation("FrmUnit", "{0} ({1})", unit.Name, unit.UnitType.Name); |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
101 } |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
102 |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
103 void unit_PointsValueChanged(WarFoundryObject obj, double oldValue, double newValue) |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
104 { |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
105 SetPointsValueText(); |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
106 } |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
107 |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
108 private void SetPointsValueText() |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
109 { |
190 | 110 lblPoints.Text = Translation.GetTranslation("FrmUnitlblPoints", "(" + unit.Points + " pts)", unit.Points, CurrentGameSystem.UsePointsAbbrev(unit.Points)); |
166
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
111 } |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
112 |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
113 private void SetStats() |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
114 { |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
115 Stat[][] stats = unit.UnitStatsArraysWithName; |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
116 string[] statsIDs = unit.UnitStatsArrayIDs; |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
117 int statsCount = stats.Length; |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
118 log.DebugFormat("Unit {0} has {1} stats arrays", unit.UnitType.Name, statsCount); |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
119 |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
120 for (int i = 0; i < statsCount; i++) |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
121 { |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
122 DataGridView statsGrid = GetDataGridView(statsIDs[i]); |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
123 DataTable dt = (DataTable)statsGrid.DataSource; |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
124 DataRow dr = dt.NewRow(); |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
125 dr.ItemArray = stats[i]; |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
126 log.DebugFormat("Add row to data table for {0}", statsIDs[i]); |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
127 dt.Rows.Add(dr); |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
128 statsGrid.ClearSelection(); |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
129 } |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
130 } |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
131 |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
132 private DataGridView GetDataGridView(string statsID) |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
133 { |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
134 DataGridView grid; |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
135 |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
136 if (DataGridViews.ContainsKey(statsID)) |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
137 { |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
138 grid = DictionaryUtils.GetValue(DataGridViews, statsID); |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
139 } |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
140 else |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
141 { |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
142 grid = CreateDataGridView(statsID); |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
143 DataGridViews[statsID] = grid; |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
144 } |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
145 |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
146 return grid; |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
147 } |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
148 |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
149 private DataGridView CreateDataGridView(string statsID) |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
150 { |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
151 log.DebugFormat("Create DataGridView for stats ID {0}", statsID); |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
152 SystemStats sysStats = unit.Race.GameSystem.GetSystemStatsForID(statsID); |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
153 StatSlot[] sysStatSlots = sysStats.StatSlots; |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
154 int statsCount = sysStatSlots.Length; |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
155 int statsWithNameCount = statsCount + 1; |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
156 StatSlot[] statsWithName = new StatSlot[statsWithNameCount]; |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
157 statsWithName[0] = new StatSlot("Name"); |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
158 sysStatSlots.CopyTo(statsWithName, 1); |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
159 DataTable dt = new DataTable(); |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
160 DataGridView statsGrid = CreateDataGridView(); |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
161 statsGrid.DataSource = dt; |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
162 int columnWidth = statsGrid.Width / (statsCount + NAME_COL_WIDTH_MULTIPLIER); |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
163 |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
164 for (int i = 0; i < statsWithNameCount; i++) |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
165 { |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
166 StatSlot stat = statsWithName[i]; |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
167 string slotName = stat.Name; |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
168 statsGrid.Columns.Add(CreateStatColumn(slotName, columnWidth)); |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
169 dt.Columns.Add(CreateDataColumn(slotName)); |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
170 } |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
171 |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
172 int otherStatsWidth = statsCount * columnWidth; |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
173 SetNameColumnWidth(statsGrid, otherStatsWidth); |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
174 |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
175 return statsGrid; |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
176 } |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
177 |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
178 private static DataGridViewColumn CreateStatColumn(string slotName, int columnWidth) |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
179 { |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
180 DataGridViewColumn col = new DataGridViewTextBoxColumn(); |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
181 col.Width = columnWidth; |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
182 col.Name = slotName; |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
183 col.HeaderText = slotName; |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
184 col.DataPropertyName = slotName; |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
185 col.SortMode = DataGridViewColumnSortMode.NotSortable; |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
186 col.CellTemplate = new StatsDataGridViewCell(); |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
187 col.HeaderCell.Style.WrapMode = DataGridViewTriState.False; |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
188 return col; |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
189 } |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
190 |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
191 private static void SetNameColumnWidth(DataGridView statsGrid, int otherStatsWidth) |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
192 { |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
193 |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
194 DataGridViewColumn nameColumn = statsGrid.Columns[0]; |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
195 nameColumn.HeaderText = Translation.GetTranslation("StatLineName", "name"); |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
196 nameColumn.Width = statsGrid.Width - otherStatsWidth; |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
197 } |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
198 |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
199 private static DataColumn CreateDataColumn(string slotName) |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
200 { |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
201 log.DebugFormat("Create column {0}", slotName); |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
202 DataColumn tempCol = new DataColumn(slotName, typeof(Stat)); |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
203 return tempCol; |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
204 } |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
205 |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
206 public DataGridView CreateDataGridView() |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
207 { |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
208 log.Debug("Create DataGridView widget"); |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
209 DataGridView statsGrid = new DataGridView(); |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
210 statsGrid.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
211 | System.Windows.Forms.AnchorStyles.Right))); |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
212 statsGrid.CausesValidation = false; |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
213 statsGrid.ReadOnly = true; |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
214 statsGrid.RowHeadersVisible = false; |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
215 statsGrid.Size = new System.Drawing.Size(600, 88); |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
216 statsGrid.TabStop = false; |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
217 statsGrid.AllowUserToAddRows = false; |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
218 statsGrid.ScrollBars = ScrollBars.None; |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
219 statsGrid.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.DisableResizing; |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
220 statsGrid.BorderStyle = BorderStyle.None; |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
221 statsGrid.BackgroundColor = SystemColors.Control; |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
222 statsGrid.RowsAdded += new DataGridViewRowsAddedEventHandler(statsGrid_RowsAdded); |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
223 statsPanel.Controls.Add(statsGrid); |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
224 statsGrid.Width = statsPanel.Width - (int)Math.Round(SystemInformation.VerticalScrollBarWidth * 1.4); |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
225 return statsGrid; |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
226 } |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
227 |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
228 private void statsGrid_RowsAdded(object sender, DataGridViewRowsAddedEventArgs e) |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
229 { |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
230 if (sender is DataGridView) |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
231 { |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
232 SetGridHeight((DataGridView)sender); |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
233 } |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
234 } |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
235 |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
236 private static void SetGridHeight(DataGridView statsGrid) |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
237 { |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
238 DataGridViewRowCollection rows = statsGrid.Rows; |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
239 statsGrid.Height = statsGrid.Columns[0].HeaderCell.Size.Height + (rows.Count * rows[0].Height); |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
240 log.DebugFormat("Set height to {0} for grid of {1} rows", statsGrid.Height, rows.Count); |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
241 } |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
242 |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
243 private void SetWeapons() |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
244 { |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
245 foreach (UnitEquipmentItem item in unit.GetEquipment()) |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
246 { |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
247 equipmentList.Items.Add(GetEquipmentChoice(item)); |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
248 } |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
249 } |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
250 |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
251 private UnitEquipmentChoice GetEquipmentChoice(UnitEquipmentItem item) |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
252 { |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
253 UnitEquipmentChoice choice = null; |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
254 equipmentChoices.TryGetValue(item, out choice); |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
255 |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
256 if (choice == null) |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
257 { |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
258 choice = new UnitEquipmentChoice(Unit, item); |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
259 equipmentChoices[item] = choice; |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
260 } |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
261 |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
262 return choice; |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
263 } |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
264 |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
265 /// <summary> |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
266 /// Clean up any resources being used. |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
267 /// </summary> |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
268 protected override void Dispose(bool disposing) |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
269 { |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
270 //remove our leave events so that disposing doesn't trigger them |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
271 tbUnitName.Leave -= new System.EventHandler(this.tbUnitName_Leave); |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
272 unitSize.Leave -= new System.EventHandler(this.unitSize_Leave); |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
273 |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
274 if (disposing) |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
275 { |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
276 if (components != null) |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
277 { |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
278 components.Dispose(); |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
279 } |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
280 } |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
281 base.Dispose(disposing); |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
282 } |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
283 |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
284 #region Windows Form Designer generated code |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
285 /// <summary> |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
286 /// Required method for Designer support - do not modify |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
287 /// the contents of this method with the code editor. |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
288 /// </summary> |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
289 private void InitializeComponent() |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
290 { |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
291 this.tbUnitName = new System.Windows.Forms.TextBox(); |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
292 this.unitSize = new System.Windows.Forms.NumericUpDown(); |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
293 this.lblUnitSize = new IBBoard.Windows.Forms.IBBLabel(); |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
294 this.lblEquip = new IBBoard.Windows.Forms.IBBLabel(); |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
295 this.bttnAddWeapon = new IBBoard.Windows.Forms.IBBButton(); |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
296 this.bttnRemoveWeapon = new IBBoard.Windows.Forms.IBBButton(); |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
297 this.equipmentList = new System.Windows.Forms.ListBox(); |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
298 this.bttnReplaceWeapon = new IBBoard.Windows.Forms.IBBButton(); |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
299 this.bttnEditWeapon = new IBBoard.Windows.Forms.IBBButton(); |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
300 this.lblPoints = new System.Windows.Forms.Label(); |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
301 this.lblNotes = new IBBoard.Windows.Forms.IBBLabel(); |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
302 this.notes = new System.Windows.Forms.TextBox(); |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
303 this.abilitiesList = new System.Windows.Forms.ListBox(); |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
304 this.lblAbilities = new IBBoard.Windows.Forms.IBBLabel(); |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
305 this.statsPanel = new System.Windows.Forms.FlowLayoutPanel(); |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
306 ((System.ComponentModel.ISupportInitialize)(this.unitSize)).BeginInit(); |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
307 this.SuspendLayout(); |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
308 // |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
309 // tbUnitName |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
310 // |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
311 this.tbUnitName.Location = new System.Drawing.Point(8, 8); |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
312 this.tbUnitName.Name = "tbUnitName"; |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
313 this.tbUnitName.Size = new System.Drawing.Size(344, 20); |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
314 this.tbUnitName.TabIndex = 1; |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
315 this.tbUnitName.KeyDown += new System.Windows.Forms.KeyEventHandler(this.tbUnitName_KeyDown); |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
316 this.tbUnitName.Leave += new System.EventHandler(this.tbUnitName_Leave); |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
317 // |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
318 // unitSize |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
319 // |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
320 this.unitSize.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
321 this.unitSize.Location = new System.Drawing.Point(528, 8); |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
322 this.unitSize.Name = "unitSize"; |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
323 this.unitSize.Size = new System.Drawing.Size(80, 20); |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
324 this.unitSize.TabIndex = 1; |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
325 this.unitSize.TextAlign = System.Windows.Forms.HorizontalAlignment.Right; |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
326 this.unitSize.Value = new decimal(new int[] { |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
327 1, |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
328 0, |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
329 0, |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
330 0}); |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
331 this.unitSize.Leave += new System.EventHandler(this.unitSize_Leave); |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
332 this.unitSize.KeyDown += new System.Windows.Forms.KeyEventHandler(this.unitSize_KeyDown); |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
333 // |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
334 // lblUnitSize |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
335 // |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
336 this.lblUnitSize.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
337 this.lblUnitSize.Location = new System.Drawing.Point(426, 8); |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
338 this.lblUnitSize.Name = "lblUnitSize"; |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
339 this.lblUnitSize.Size = new System.Drawing.Size(98, 23); |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
340 this.lblUnitSize.TabIndex = 0; |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
341 this.lblUnitSize.Text = "unit size"; |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
342 this.lblUnitSize.TextAlign = System.Drawing.ContentAlignment.TopRight; |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
343 // |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
344 // lblEquip |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
345 // |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
346 this.lblEquip.Location = new System.Drawing.Point(15, 126); |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
347 this.lblEquip.Name = "lblEquip"; |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
348 this.lblEquip.Size = new System.Drawing.Size(81, 108); |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
349 this.lblEquip.TabIndex = 3; |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
350 this.lblEquip.Text = "equipment"; |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
351 this.lblEquip.TextAlign = System.Drawing.ContentAlignment.TopRight; |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
352 // |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
353 // bttnAddWeapon |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
354 // |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
355 this.bttnAddWeapon.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
356 this.bttnAddWeapon.FlatStyle = System.Windows.Forms.FlatStyle.System; |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
357 this.bttnAddWeapon.Location = new System.Drawing.Point(516, 126); |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
358 this.bttnAddWeapon.Name = "bttnAddWeapon"; |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
359 this.bttnAddWeapon.Size = new System.Drawing.Size(88, 22); |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
360 this.bttnAddWeapon.TabIndex = 4; |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
361 this.bttnAddWeapon.Text = "add"; |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
362 this.bttnAddWeapon.Click += new System.EventHandler(this.bttnAddWeapon_Click); |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
363 // |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
364 // bttnRemoveWeapon |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
365 // |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
366 this.bttnRemoveWeapon.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
367 this.bttnRemoveWeapon.Enabled = false; |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
368 this.bttnRemoveWeapon.FlatStyle = System.Windows.Forms.FlatStyle.System; |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
369 this.bttnRemoveWeapon.Location = new System.Drawing.Point(516, 210); |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
370 this.bttnRemoveWeapon.Name = "bttnRemoveWeapon"; |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
371 this.bttnRemoveWeapon.Size = new System.Drawing.Size(88, 22); |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
372 this.bttnRemoveWeapon.TabIndex = 5; |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
373 this.bttnRemoveWeapon.Text = "remove"; |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
374 this.bttnRemoveWeapon.Click += new System.EventHandler(this.bttnRemoveWeapon_Click); |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
375 // |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
376 // equipmentList |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
377 // |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
378 this.equipmentList.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
379 | System.Windows.Forms.AnchorStyles.Right))); |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
380 this.equipmentList.Location = new System.Drawing.Point(102, 126); |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
381 this.equipmentList.Name = "equipmentList"; |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
382 this.equipmentList.Size = new System.Drawing.Size(408, 108); |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
383 this.equipmentList.TabIndex = 6; |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
384 this.equipmentList.SelectedIndexChanged += new System.EventHandler(this.equipmentList_SelectedIndexChanged); |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
385 this.equipmentList.DoubleClick += new System.EventHandler(this.equipmentList_DoubleClick); |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
386 // |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
387 // bttnReplaceWeapon |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
388 // |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
389 this.bttnReplaceWeapon.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
390 this.bttnReplaceWeapon.Enabled = false; |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
391 this.bttnReplaceWeapon.FlatStyle = System.Windows.Forms.FlatStyle.System; |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
392 this.bttnReplaceWeapon.Location = new System.Drawing.Point(516, 182); |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
393 this.bttnReplaceWeapon.Name = "bttnReplaceWeapon"; |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
394 this.bttnReplaceWeapon.Size = new System.Drawing.Size(88, 22); |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
395 this.bttnReplaceWeapon.TabIndex = 10; |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
396 this.bttnReplaceWeapon.Text = "replace"; |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
397 this.bttnReplaceWeapon.Click += new System.EventHandler(this.bttnReplaceWeapon_Click); |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
398 // |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
399 // bttnEditWeapon |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
400 // |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
401 this.bttnEditWeapon.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
402 this.bttnEditWeapon.Enabled = false; |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
403 this.bttnEditWeapon.FlatStyle = System.Windows.Forms.FlatStyle.System; |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
404 this.bttnEditWeapon.Location = new System.Drawing.Point(516, 154); |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
405 this.bttnEditWeapon.Name = "bttnEditWeapon"; |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
406 this.bttnEditWeapon.Size = new System.Drawing.Size(88, 22); |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
407 this.bttnEditWeapon.TabIndex = 11; |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
408 this.bttnEditWeapon.Text = "edit"; |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
409 this.bttnEditWeapon.Click += new System.EventHandler(this.bttnEditWeapon_Click); |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
410 // |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
411 // lblPoints |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
412 // |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
413 this.lblPoints.Location = new System.Drawing.Point(358, 8); |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
414 this.lblPoints.Name = "lblPoints"; |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
415 this.lblPoints.Size = new System.Drawing.Size(77, 21); |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
416 this.lblPoints.TabIndex = 12; |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
417 this.lblPoints.Text = "(points)"; |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
418 // |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
419 // lblNotes |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
420 // |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
421 this.lblNotes.Location = new System.Drawing.Point(13, 317); |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
422 this.lblNotes.Name = "lblNotes"; |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
423 this.lblNotes.Size = new System.Drawing.Size(84, 62); |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
424 this.lblNotes.TabIndex = 13; |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
425 this.lblNotes.Text = "notes"; |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
426 this.lblNotes.TextAlign = System.Drawing.ContentAlignment.TopRight; |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
427 // |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
428 // notes |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
429 // |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
430 this.notes.Location = new System.Drawing.Point(102, 317); |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
431 this.notes.Multiline = true; |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
432 this.notes.Name = "notes"; |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
433 this.notes.ReadOnly = true; |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
434 this.notes.Size = new System.Drawing.Size(408, 62); |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
435 this.notes.TabIndex = 14; |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
436 // |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
437 // abilitiesList |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
438 // |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
439 this.abilitiesList.FormattingEnabled = true; |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
440 this.abilitiesList.Location = new System.Drawing.Point(102, 240); |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
441 this.abilitiesList.Name = "abilitiesList"; |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
442 this.abilitiesList.Size = new System.Drawing.Size(408, 69); |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
443 this.abilitiesList.TabIndex = 15; |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
444 // |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
445 // lblAbilities |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
446 // |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
447 this.lblAbilities.Location = new System.Drawing.Point(13, 240); |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
448 this.lblAbilities.Name = "lblAbilities"; |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
449 this.lblAbilities.Size = new System.Drawing.Size(84, 62); |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
450 this.lblAbilities.TabIndex = 16; |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
451 this.lblAbilities.Text = "abilities"; |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
452 this.lblAbilities.TextAlign = System.Drawing.ContentAlignment.TopRight; |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
453 // |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
454 // statsPanel |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
455 // |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
456 this.statsPanel.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
457 | System.Windows.Forms.AnchorStyles.Right))); |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
458 this.statsPanel.AutoScroll = true; |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
459 this.statsPanel.Location = new System.Drawing.Point(8, 35); |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
460 this.statsPanel.Name = "statsPanel"; |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
461 this.statsPanel.Size = new System.Drawing.Size(600, 85); |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
462 this.statsPanel.TabIndex = 17; |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
463 // |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
464 // FrmUnit |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
465 // |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
466 this.AutoScaleBaseSize = new System.Drawing.Size(5, 13); |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
467 this.ClientSize = new System.Drawing.Size(616, 391); |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
468 this.Controls.Add(this.statsPanel); |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
469 this.Controls.Add(this.lblAbilities); |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
470 this.Controls.Add(this.abilitiesList); |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
471 this.Controls.Add(this.notes); |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
472 this.Controls.Add(this.lblNotes); |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
473 this.Controls.Add(this.lblPoints); |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
474 this.Controls.Add(this.bttnEditWeapon); |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
475 this.Controls.Add(this.bttnReplaceWeapon); |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
476 this.Controls.Add(this.equipmentList); |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
477 this.Controls.Add(this.bttnRemoveWeapon); |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
478 this.Controls.Add(this.bttnAddWeapon); |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
479 this.Controls.Add(this.lblEquip); |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
480 this.Controls.Add(this.lblUnitSize); |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
481 this.Controls.Add(this.unitSize); |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
482 this.Controls.Add(this.tbUnitName); |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
483 this.Name = "FrmUnit"; |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
484 this.ShowIcon = false; |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
485 this.ShowInTaskbar = false; |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
486 this.Text = "FrmUnit"; |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
487 this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.FrmUnit_FormClosing); |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
488 ((System.ComponentModel.ISupportInitialize)(this.unitSize)).EndInit(); |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
489 this.ResumeLayout(false); |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
490 this.PerformLayout(); |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
491 |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
492 } |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
493 #endregion |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
494 |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
495 public Unit Unit |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
496 { |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
497 get { return unit; } |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
498 } |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
499 |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
500 private void tbUnitName_Leave(object sender, System.EventArgs e) |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
501 { |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
502 UpdateUnitName(); |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
503 } |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
504 |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
505 private void tbUnitName_KeyDown(object sender, System.Windows.Forms.KeyEventArgs e) |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
506 { |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
507 if (e.KeyCode == Keys.Enter) |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
508 { |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
509 UpdateUnitName(); |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
510 } |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
511 } |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
512 |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
513 private void UpdateUnitName() |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
514 { |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
515 if (unit.Name != tbUnitName.Text) |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
516 { |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
517 commandStack.Execute(new SetNameCommand(unit, tbUnitName.Text)); |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
518 } |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
519 } |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
520 |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
521 private void unitSize_Leave(object sender, System.EventArgs e) |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
522 { |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
523 UpdateUnitSize(); |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
524 } |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
525 |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
526 private void unitSize_KeyDown(object sender, System.Windows.Forms.KeyEventArgs e) |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
527 { |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
528 if (e.KeyCode == Keys.Enter) |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
529 { |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
530 UpdateUnitSize(); |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
531 } |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
532 } |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
533 |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
534 private void UpdateUnitSize() |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
535 { |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
536 if (unit.Size != unitSize.Value) |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
537 { |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
538 commandStack.Execute(new SetUnitSizeCommand(unit, (int) unitSize.Value)); |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
539 } |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
540 } |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
541 |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
542 private void unit_NameChanged(WarFoundryObject obj, string oldValue, string newValue) |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
543 { |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
544 if (obj is Unit && obj.Equals(unit)) |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
545 { |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
546 SetUnitName(); |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
547 } |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
548 } |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
549 |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
550 private void unit_UnitSizeChanged(WarFoundryObject obj, int oldValue, int newValue) |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
551 { |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
552 if (obj is Unit && obj.Equals(unit)) |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
553 { |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
554 unitSize.Value = newValue; |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
555 } |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
556 } |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
557 |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
558 private void RefreshUnitEquipment() |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
559 { |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
560 foreach (UnitEquipmentChoice choice in equipmentChoices.Values) |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
561 { |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
562 SetEquipmentListValue(choice); |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
563 } |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
564 } |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
565 |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
566 private void equipmentList_SelectedIndexChanged(object sender, System.EventArgs e) |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
567 { |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
568 SetButtonsEnabledState(); |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
569 } |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
570 |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
571 private void SetButtonsEnabledState() |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
572 { |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
573 |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
574 UnitEquipmentItem equipItem = GetSelectedUnitEquipmentItem(); |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
575 bttnReplaceWeapon.Enabled = (equipItem != null && equipItem.HasAlternatives()); |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
576 bttnEditWeapon.Enabled = (equipItem != null); |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
577 bttnRemoveWeapon.Enabled = (equipItem != null && !equipItem.IsRequired); |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
578 } |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
579 |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
580 private void unit_UnitEquipmentAmountChanged(WarFoundryObject obj, double oldValue, double newValue) |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
581 { |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
582 if (obj is UnitEquipmentItem) |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
583 { |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
584 UnitEquipmentItem equip = (UnitEquipmentItem) obj; |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
585 UnitEquipmentChoice equipChoice = GetEquipmentChoice(equip); |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
586 |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
587 if (newValue == 0) |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
588 { |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
589 equipmentList.Items.Remove(equipChoice); |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
590 } |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
591 else |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
592 { |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
593 SetEquipmentListValue(equipChoice); |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
594 } |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
595 } |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
596 } |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
597 |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
598 private void SetEquipmentListValue(UnitEquipmentChoice equipChoice) |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
599 { |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
600 int idx = equipmentList.Items.IndexOf(equipChoice); |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
601 |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
602 if (idx > -1) |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
603 { |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
604 equipmentList.Items[idx] = equipChoice; |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
605 } |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
606 else |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
607 { |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
608 equipmentList.Items.Add(equipChoice); |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
609 } |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
610 } |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
611 |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
612 private void EditWeapon() |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
613 { |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
614 UnitEquipmentItem item = GetSelectedUnitEquipmentItem(); |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
615 |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
616 if (item != null) |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
617 { |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
618 FrmEditUnitEquipment editEquip = new FrmEditUnitEquipment(Unit, item, commandStack); |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
619 editEquip.ShowDialog(this); |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
620 } |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
621 } |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
622 |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
623 private UnitEquipmentItem GetSelectedUnitEquipmentItem() |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
624 { |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
625 UnitEquipmentChoice selectedItem = GetSelectedUnitEquipmentChoice(); |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
626 UnitEquipmentItem equipItem = null; |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
627 |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
628 if (selectedItem!=null) |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
629 { |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
630 equipItem = selectedItem.Item; |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
631 } |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
632 |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
633 return equipItem; |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
634 } |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
635 |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
636 private UnitEquipmentChoice GetSelectedUnitEquipmentChoice() |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
637 { |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
638 return (UnitEquipmentChoice) equipmentList.SelectedItem; |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
639 } |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
640 |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
641 private void bttnEditWeapon_Click(object sender, System.EventArgs e) |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
642 { |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
643 EditWeapon(); |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
644 } |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
645 |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
646 private void equipmentList_DoubleClick(object sender, System.EventArgs e) |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
647 { |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
648 EditWeapon(); |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
649 } |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
650 |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
651 private void AddWeapon() |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
652 { |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
653 FrmNewUnitEquipment newEquip = new FrmNewUnitEquipment(Unit, commandStack); |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
654 newEquip.ShowDialog(this); |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
655 } |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
656 |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
657 private void bttnAddWeapon_Click(object sender, System.EventArgs e) |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
658 { |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
659 AddWeapon(); |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
660 } |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
661 |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
662 private void RemoveWeapon() |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
663 { |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
664 commandStack.Execute(new SetUnitEquipmentNumericAmountCommand(unit, GetSelectedUnitEquipmentItem(), 0)); |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
665 } |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
666 |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
667 private void bttnRemoveWeapon_Click(object sender, System.EventArgs e) |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
668 { |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
669 RemoveWeapon(); |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
670 } |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
671 |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
672 private void bttnReplaceWeapon_Click(object sender, System.EventArgs e) |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
673 { |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
674 FrmReplaceUnitEquipment replace = new FrmReplaceUnitEquipment(unit, GetSelectedUnitEquipmentItem(), commandStack); |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
675 replace.ShowDialog(this); |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
676 } |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
677 |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
678 private void FrmUnit_FormClosing(object sender, FormClosingEventArgs e) |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
679 { |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
680 UpdateUnitName(); |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
681 UpdateUnitSize(); |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
682 } |
97fd4b6f823b
Fixes #294: Fix data grid header wrapping problems
IBBoard <dev@ibboard.co.uk>
parents:
165
diff
changeset
|
683 } |
27
526fefefb16b
Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
684 } |