comparison FrmReplaceUnitEquipment.cs @ 169:b7899d084a14

"Re #299: Untranslated strings" fixed the Replaced equipment form to accept new translated strings. Added FrmReplaceUnitEquipment
author snowblizz
date Sun, 25 Jul 2010 17:14:43 +0000
parents 3e78af88ceb3
children
comparison
equal deleted inserted replaced
168:2a8cdd4918eb 169:b7899d084a14
6 using System.Drawing; 6 using System.Drawing;
7 using System.ComponentModel; 7 using System.ComponentModel;
8 using System.Windows.Forms; 8 using System.Windows.Forms;
9 using IBBoard; 9 using IBBoard;
10 using IBBoard.Commands; 10 using IBBoard.Commands;
11 using IBBoard.Lang;
11 using IBBoard.WarFoundry.API; 12 using IBBoard.WarFoundry.API;
12 using IBBoard.WarFoundry.API.Commands; 13 using IBBoard.WarFoundry.API.Commands;
13 using IBBoard.WarFoundry.API.Objects; 14 using IBBoard.WarFoundry.API.Objects;
14 using IBBoard.WarFoundry.API.Util; 15 using IBBoard.WarFoundry.API.Util;
15 16 using IBBoard.WarFoundry.GUI.WinForms.UI;
16 namespace IBBoard.WarFoundry 17 using IBBoard.WarFoundry.GUI.WinForms.Util;
18 using IBBoard.Windows.Forms;
19 using IBBoard.Windows.Forms.I18N;
20
21 namespace IBBoard.WarFoundry.GUI.WinForms
17 { 22 {
18 /// <summary> 23 /// <summary>
19 /// Summary description for FrmNewUnitEquipment. 24 /// Summary description for FrmNewUnitEquipment.
20 /// </summary> 25 /// </summary>
21 public class FrmReplaceUnitEquipment : System.Windows.Forms.Form 26 public class FrmReplaceUnitEquipment : IBBForm
22 { 27 {
23 private Unit unit; 28 private Unit unit;
24 private UnitEquipmentItem oldItem; 29 private UnitEquipmentItem oldItem;
25 private CommandStack commandStack; 30 private CommandStack commandStack;
26 private System.Windows.Forms.Label lblAmount; 31 private IBBLabel lblAmount;
27 private System.Windows.Forms.Button bttnCancel; 32 private IBBButton bttnCancel;
28 private System.Windows.Forms.Button bttnOkay; 33 private IBBButton bttnOkay;
29 private System.Windows.Forms.Label lblItem; 34 private IBBLabel lblItem;
30 private System.Windows.Forms.ListBox listItems; 35 private System.Windows.Forms.ListBox listItems;
31 private IBBoard.WarFoundry.GUI.WinForms.UI.EquipmentAmountControl equipmentAmount; 36 private IBBoard.WarFoundry.GUI.WinForms.UI.EquipmentAmountControl equipmentAmount;
32 /// <summary> 37 /// <summary>
33 /// Required designer variable. 38 /// Required designer variable.
34 /// </summary> 39 /// </summary>
38 { 43 {
39 commandStack = stack; 44 commandStack = stack;
40 this.unit = unit; 45 this.unit = unit;
41 oldItem = item; 46 oldItem = item;
42 InitializeComponent(); 47 InitializeComponent();
43 this.Text = "Replace " + item.EquipmentItem.Name + " with new equipment"; 48 ControlTranslator.TranslateControl(this);
49 this.Text = Translation.GetTranslation("FrmReplaceUnitEquipment", "replace {0} with new equipment", item.EquipmentItem.Name);
44 object[] items = Arrays.Subtract(unit.UnitType.GetEquipmentItemsByExclusionGroups(item.MutexGroups), unit.GetEquipment()); 50 object[] items = Arrays.Subtract(unit.UnitType.GetEquipmentItemsByExclusionGroups(item.MutexGroups), unit.GetEquipment());
45 listItems.Items.AddRange(items); 51 listItems.Items.AddRange(items);
46 equipmentAmount.SetUnit(unit); 52 equipmentAmount.SetUnit(unit);
47 } 53 }
48 54
66 /// Required method for Designer support - do not modify 72 /// Required method for Designer support - do not modify
67 /// the contents of this method with the code editor. 73 /// the contents of this method with the code editor.
68 /// </summary> 74 /// </summary>
69 private void InitializeComponent() 75 private void InitializeComponent()
70 { 76 {
71 this.lblAmount = new System.Windows.Forms.Label(); 77 this.lblAmount = new IBBoard.Windows.Forms.IBBLabel();
72 this.bttnCancel = new System.Windows.Forms.Button(); 78 this.bttnCancel = new IBBoard.Windows.Forms.IBBButton();
73 this.bttnOkay = new System.Windows.Forms.Button(); 79 this.bttnOkay = new IBBoard.Windows.Forms.IBBButton();
74 this.lblItem = new System.Windows.Forms.Label(); 80 this.lblItem = new IBBoard.Windows.Forms.IBBLabel();
75 this.listItems = new System.Windows.Forms.ListBox(); 81 this.listItems = new System.Windows.Forms.ListBox();
76 this.equipmentAmount = new IBBoard.WarFoundry.GUI.WinForms.UI.EquipmentAmountControl(); 82 this.equipmentAmount = new IBBoard.WarFoundry.GUI.WinForms.UI.EquipmentAmountControl();
77 this.SuspendLayout(); 83 this.SuspendLayout();
78 // 84 //
79 // lblAmount 85 // lblAmount
80 // 86 //
81 this.lblAmount.Location = new System.Drawing.Point(8, 80); 87 this.lblAmount.Location = new System.Drawing.Point(8, 80);
82 this.lblAmount.Name = "lblAmount"; 88 this.lblAmount.Name = "lblAmount";
83 this.lblAmount.Size = new System.Drawing.Size(72, 23); 89 this.lblAmount.Size = new System.Drawing.Size(72, 23);
84 this.lblAmount.TabIndex = 2; 90 this.lblAmount.TabIndex = 2;
85 this.lblAmount.Text = "amount"; 91 this.lblAmount.Text = "amount";
86 this.lblAmount.TextAlign = System.Drawing.ContentAlignment.TopRight; 92 this.lblAmount.TextAlign = System.Drawing.ContentAlignment.TopRight;
87 // 93 //
88 // bttnCancel 94 // bttnCancel
89 // 95 //
90 this.bttnCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel; 96 this.bttnCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel;
91 this.bttnCancel.FlatStyle = System.Windows.Forms.FlatStyle.System; 97 this.bttnCancel.FlatStyle = System.Windows.Forms.FlatStyle.System;
92 this.bttnCancel.Location = new System.Drawing.Point(159, 184); 98 this.bttnCancel.Location = new System.Drawing.Point(159, 184);
93 this.bttnCancel.Name = "bttnCancel"; 99 this.bttnCancel.Name = "bttnCancel";
94 this.bttnCancel.Size = new System.Drawing.Size(75, 23); 100 this.bttnCancel.Size = new System.Drawing.Size(75, 23);
95 this.bttnCancel.TabIndex = 3; 101 this.bttnCancel.TabIndex = 3;
96 this.bttnCancel.Text = "cancel"; 102 this.bttnCancel.Text = "cancel";
97 this.bttnCancel.Click += new System.EventHandler(this.bttnCancel_Click); 103 this.bttnCancel.Click += new System.EventHandler(this.bttnCancel_Click);
98 // 104 //
99 // bttnOkay 105 // bttnOkay
100 // 106 //
101 this.bttnOkay.Enabled = false; 107 this.bttnOkay.DialogResult = System.Windows.Forms.DialogResult.Cancel;
102 this.bttnOkay.FlatStyle = System.Windows.Forms.FlatStyle.System; 108 this.bttnOkay.Enabled = false;
103 this.bttnOkay.Location = new System.Drawing.Point(11, 184); 109 this.bttnOkay.FlatStyle = System.Windows.Forms.FlatStyle.System;
104 this.bttnOkay.Name = "bttnOkay"; 110 this.bttnOkay.Location = new System.Drawing.Point(11, 184);
105 this.bttnOkay.Size = new System.Drawing.Size(75, 23); 111 this.bttnOkay.Name = "bttnOkay";
106 this.bttnOkay.TabIndex = 4; 112 this.bttnOkay.Size = new System.Drawing.Size(75, 23);
107 this.bttnOkay.Text = "okay"; 113 this.bttnOkay.TabIndex = 4;
108 this.bttnOkay.Click += new System.EventHandler(this.bttnOkay_Click); 114 this.bttnOkay.Text = "okay";
109 // 115 this.bttnOkay.Click += new System.EventHandler(this.bttnOkay_Click);
110 // lblItem 116 //
111 // 117 // lblItem
112 this.lblItem.Location = new System.Drawing.Point(0, 8); 118 //
113 this.lblItem.Name = "lblItem"; 119 this.lblItem.Location = new System.Drawing.Point(0, 8);
114 this.lblItem.Size = new System.Drawing.Size(80, 23); 120 this.lblItem.Name = "lblItem";
115 this.lblItem.TabIndex = 6; 121 this.lblItem.Size = new System.Drawing.Size(68, 69);
116 this.lblItem.Text = "item"; 122 this.lblItem.TabIndex = 6;
117 this.lblItem.TextAlign = System.Drawing.ContentAlignment.TopRight; 123 this.lblItem.Text = "item";
118 // 124 this.lblItem.TextAlign = System.Drawing.ContentAlignment.TopRight;
119 // listItems 125 //
120 // 126 // listItems
121 this.listItems.Location = new System.Drawing.Point(86, 8); 127 //
122 this.listItems.Name = "listItems"; 128 this.listItems.Location = new System.Drawing.Point(86, 8);
123 this.listItems.Size = new System.Drawing.Size(144, 69); 129 this.listItems.Name = "listItems";
124 this.listItems.TabIndex = 7; 130 this.listItems.Size = new System.Drawing.Size(144, 69);
125 this.listItems.SelectedIndexChanged += new System.EventHandler(this.listItems_SelectedIndexChanged); 131 this.listItems.TabIndex = 7;
126 // 132 this.listItems.SelectedIndexChanged += new System.EventHandler(this.listItems_SelectedIndexChanged);
127 // equipmentAmount 133 //
128 // 134 // equipmentAmount
129 this.equipmentAmount.Location = new System.Drawing.Point(86, 83); 135 //
130 this.equipmentAmount.Name = "equipmentAmount"; 136 this.equipmentAmount.Location = new System.Drawing.Point(86, 83);
131 this.equipmentAmount.Size = new System.Drawing.Size(155, 77); 137 this.equipmentAmount.Name = "equipmentAmount";
132 this.equipmentAmount.TabIndex = 8; 138 this.equipmentAmount.Size = new System.Drawing.Size(155, 77);
133 // 139 this.equipmentAmount.TabIndex = 8;
134 // FrmReplaceUnitEquipment 140 //
135 // 141 // FrmReplaceUnitEquipment
136 this.AutoScaleBaseSize = new System.Drawing.Size(5, 13); 142 //
137 this.ClientSize = new System.Drawing.Size(246, 219); 143 this.AcceptButton = this.bttnOkay;
138 this.ControlBox = false; 144 this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
139 this.Controls.Add(this.equipmentAmount); 145 this.CancelButton = this.bttnCancel;
140 this.Controls.Add(this.listItems); 146 this.ClientSize = new System.Drawing.Size(246, 219);
141 this.Controls.Add(this.lblItem); 147 this.ControlBox = false;
142 this.Controls.Add(this.bttnOkay); 148 this.Controls.Add(this.equipmentAmount);
143 this.Controls.Add(this.bttnCancel); 149 this.Controls.Add(this.listItems);
144 this.Controls.Add(this.lblAmount); 150 this.Controls.Add(this.lblItem);
145 this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog; 151 this.Controls.Add(this.bttnOkay);
146 this.Name = "FrmReplaceUnitEquipment"; 152 this.Controls.Add(this.bttnCancel);
147 this.ShowInTaskbar = false; 153 this.Controls.Add(this.lblAmount);
148 this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; 154 this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
149 this.Text = "FrmEditUnitEquipment"; 155 this.Name = "FrmReplaceUnitEquipment";
150 this.ResumeLayout(false); 156 this.ShowInTaskbar = false;
157 this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
158 this.Text = "FrmReplaceUnitEquipment";
159 this.ResumeLayout(false);
151 160
152 } 161 }
153 #endregion 162 #endregion
154 163
155 private void bttnOkay_Click(object sender, System.EventArgs e) 164 private void bttnOkay_Click(object sender, System.EventArgs e)