Subversion Repositories spk

Rev

Rev 218 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
1 cycrow 1
#pragma once
2
 
3
using namespace System;
4
using namespace System::ComponentModel;
5
using namespace System::Collections;
6
using namespace System::Windows::Forms;
7
using namespace System::Data;
8
using namespace System::Drawing;
9
 
10
#include "CustomiseTurret.h"
11
#include "CustomiseGuns.h"
12
#include "CustomiseWeapons.h"
13
#include "CustomiseWeapons1.h"
14
#include "CustomiseModel.h"
15
#include "CustomisePerformance.h"
16
#include "CustomiseInfo.h"
17
 
18
namespace Creator {
19
 
20
	/// <summary>
21
	/// Summary for CustomiseShip
22
	///
23
	/// WARNING: If you change the name of this class, you will need to change the
24
	///          'Resource File Name' property for the managed resource compiler tool
25
	///          associated with all .resx files this class depends on.  Otherwise
26
	///          the designers will not be able to interact properly with localized
27
	///          resources associated with this form.
28
	/// </summary>
29
	public ref class CustomiseShip : public System::Windows::Forms::Form
30
	{
31
	public:
94 cycrow 32
		CustomiseShip(CXspFile *shipFile, Windows::Forms::Form ^mainForm, CPackages *p, ImageList ^imagesSmall, ImageList ^imagesLarge, CGameDirectories *gameDir);
1 cycrow 33
 
94 cycrow 34
		CGameDirectories *gameDirectories();
1 cycrow 35
 
36
		String ^GetPosition(int pos)
37
		{
38
			switch ( pos )
39
			{
40
				case 0:
41
					return "Cockpit";	
42
				case 1: 
43
					return "Front";
44
				case 2:
45
					return "Rear";
46
				case 3:
47
					return "Left";
48
				case 4:
49
					return "Right";
50
				case 5:
51
					return "Top";
52
				case 6:
53
					return "Bottom";
54
			}
55
			return "";
56
		}
57
 
58
		void UpdateGunTurrets() { m_pCustomiseGuns->UpdateGunTurrets(); }
94 cycrow 59
		void SetupControls();
103 cycrow 60
		void SwitchGame();
61
		void LoadText(CVirtualFileSystem *vfs);
1 cycrow 62
 
63
		void UpdateDisplay()
64
		{
65
			m_pCustomiseInfo->UpdateDisplay();
66
			m_pCustomisePerformance->UpdateDisplay();
67
			m_pCustomiseWeapons1->UpdateDisplay();
68
			m_pCustomiseModel->UpdateDisplay();
69
			m_pCustomiseTurret->UpdateDisplay();
70
		}
71
 
72
	protected:
73
		~CustomiseShip()
74
		{
75
			if (components)
76
			{
77
				delete components;
78
			}
79
			delete m_pShipData;
80
			if ( m_pWeapons )
81
				m_pWeapons->MemoryClear();
82
			delete m_pWeapons;
170 cycrow 83
			if ( _pModels )
84
				delete _pModels;
1 cycrow 85
		}
86
 
87
		CustomiseInfo			^m_pCustomiseInfo;
88
		CustomisePerformance	^m_pCustomisePerformance;
89
		CustomiseWeapons1		^m_pCustomiseWeapons1;
90
		CustomiseModel			^m_pCustomiseModel;
91
		CustomiseWeapons		^m_pCustomiseWeapons;
92
		CustomiseGuns			^m_pCustomiseGuns;
93
		CustomiseTurret			^m_pCustomiseTurret;
94
		CLinkList<SWeaponMasks> *m_pWeapons;
95
		CPackages				*m_pPackages;
96
		bool					 m_bUpdateing;
97
		Windows::Forms::Form	^m_pMainForm;
98
		CXspFile				*m_pShipFile;
99
		CShipData				*m_pShipData;
218 cycrow 100
		Utils::WStringList		*_pModels;
94 cycrow 101
		CGameDirectories		*_pGameDir;
1 cycrow 102
 
103
		/// <summary>
104
		/// Clean up any resources being used.
105
		/// </summary>
106
		private: System::Windows::Forms::Panel^  panel1;
107
		private: System::Windows::Forms::Label^  label1;
108
		private: System::Windows::Forms::ComboBox^  ComboGame;
109
		private: System::Windows::Forms::Panel^  panel2;
110
		private: System::Windows::Forms::Button^  button2;
111
		private: System::Windows::Forms::Button^  ButSave;
112
private: System::Windows::Forms::ListView^  listView2;
113
private: System::Windows::Forms::ListView^  listView1;
114
private: System::Windows::Forms::CheckBox^  CheckWeaponDefaultCockpit;
115
private: System::Windows::Forms::TabPage^  tabPage7;
116
private: System::Windows::Forms::TabPage^  tabPage6;
117
private: System::Windows::Forms::TabPage^  tabPage5;
118
private: System::Windows::Forms::TabPage^  tabPage4;
119
private: System::Windows::Forms::TabPage^  tabPage3;
120
private: System::Windows::Forms::TabPage^  tabPage2;
121
private: System::Windows::Forms::TabControl^  tabControl1;
122
 
123
private: System::Windows::Forms::TabPage^  tabPage1;
124
 
125
private: System::ComponentModel::IContainer^  components;
126
		 /// <summary>
127
		/// Required designer variable.
128
		/// </summary>
129
 
130
#pragma region Windows Form Designer generated code
131
		/// <summary>
132
		/// Required method for Designer support - do not modify
133
		/// the contents of this method with the code editor.
134
		/// </summary>
135
		void InitializeComponent(void)
136
		{
137
			this->panel1 = (gcnew System::Windows::Forms::Panel());
138
			this->ComboGame = (gcnew System::Windows::Forms::ComboBox());
139
			this->label1 = (gcnew System::Windows::Forms::Label());
140
			this->panel2 = (gcnew System::Windows::Forms::Panel());
141
			this->button2 = (gcnew System::Windows::Forms::Button());
142
			this->ButSave = (gcnew System::Windows::Forms::Button());
143
			this->tabPage7 = (gcnew System::Windows::Forms::TabPage());
144
			this->tabPage6 = (gcnew System::Windows::Forms::TabPage());
145
			this->tabPage5 = (gcnew System::Windows::Forms::TabPage());
146
			this->tabPage4 = (gcnew System::Windows::Forms::TabPage());
147
			this->tabPage3 = (gcnew System::Windows::Forms::TabPage());
148
			this->tabPage2 = (gcnew System::Windows::Forms::TabPage());
149
			this->tabControl1 = (gcnew System::Windows::Forms::TabControl());
150
			this->tabPage1 = (gcnew System::Windows::Forms::TabPage());
151
			this->panel1->SuspendLayout();
152
			this->panel2->SuspendLayout();
153
			this->tabControl1->SuspendLayout();
154
			this->SuspendLayout();
155
			// 
156
			// panel1
157
			// 
158
			this->panel1->Controls->Add(this->ComboGame);
159
			this->panel1->Controls->Add(this->label1);
160
			this->panel1->Dock = System::Windows::Forms::DockStyle::Top;
161
			this->panel1->Location = System::Drawing::Point(10, 10);
162
			this->panel1->Name = L"panel1";
163
			this->panel1->Padding = System::Windows::Forms::Padding(5);
164
			this->panel1->Size = System::Drawing::Size(548, 32);
165
			this->panel1->TabIndex = 0;
166
			// 
167
			// ComboGame
168
			// 
169
			this->ComboGame->Dock = System::Windows::Forms::DockStyle::Fill;
170
			this->ComboGame->DropDownStyle = System::Windows::Forms::ComboBoxStyle::DropDownList;
171
			this->ComboGame->FormattingEnabled = true;
172
			this->ComboGame->Location = System::Drawing::Point(155, 5);
173
			this->ComboGame->Name = L"ComboGame";
174
			this->ComboGame->Size = System::Drawing::Size(388, 21);
175
			this->ComboGame->TabIndex = 1;
176
			this->ComboGame->SelectedIndexChanged += gcnew System::EventHandler(this, &CustomiseShip::ComboGame_SelectedIndexChanged);
177
			// 
178
			// label1
179
			// 
180
			this->label1->Dock = System::Windows::Forms::DockStyle::Left;
238 cycrow 181
			this->label1->Font = (gcnew System::Drawing::Font(L"Microsoft Sans Serif", 9.75F, System::Drawing::FontStyle::Bold, System::Drawing::GraphicsUnit::Point,
1 cycrow 182
				static_cast<System::Byte>(0)));
183
			this->label1->Location = System::Drawing::Point(5, 5);
184
			this->label1->Name = L"label1";
185
			this->label1->Size = System::Drawing::Size(150, 22);
186
			this->label1->TabIndex = 0;
187
			this->label1->Text = L"Primary Game";
188
			this->label1->TextAlign = System::Drawing::ContentAlignment::MiddleLeft;
189
			// 
190
			// panel2
191
			// 
192
			this->panel2->Controls->Add(this->button2);
193
			this->panel2->Controls->Add(this->ButSave);
194
			this->panel2->Dock = System::Windows::Forms::DockStyle::Bottom;
195
			this->panel2->Location = System::Drawing::Point(10, 553);
196
			this->panel2->Name = L"panel2";
197
			this->panel2->Padding = System::Windows::Forms::Padding(8);
198
			this->panel2->Size = System::Drawing::Size(548, 46);
199
			this->panel2->TabIndex = 1;
200
			// 
201
			// button2
202
			// 
203
			this->button2->DialogResult = System::Windows::Forms::DialogResult::Cancel;
204
			this->button2->Dock = System::Windows::Forms::DockStyle::Right;
205
			this->button2->Location = System::Drawing::Point(331, 8);
206
			this->button2->Name = L"button2";
207
			this->button2->Size = System::Drawing::Size(99, 30);
208
			this->button2->TabIndex = 1;
209
			this->button2->Text = L"Cancel";
210
			this->button2->UseVisualStyleBackColor = true;
211
			// 
212
			// ButSave
213
			// 
214
			this->ButSave->DialogResult = System::Windows::Forms::DialogResult::OK;
215
			this->ButSave->Dock = System::Windows::Forms::DockStyle::Right;
216
			this->ButSave->Location = System::Drawing::Point(430, 8);
217
			this->ButSave->Name = L"ButSave";
218
			this->ButSave->Size = System::Drawing::Size(110, 30);
219
			this->ButSave->TabIndex = 0;
220
			this->ButSave->Text = L"Save";
221
			this->ButSave->UseVisualStyleBackColor = true;
222
			this->ButSave->Click += gcnew System::EventHandler(this, &CustomiseShip::ButSave_Click);
223
			// 
224
			// tabPage7
225
			// 
226
			this->tabPage7->Location = System::Drawing::Point(4, 22);
227
			this->tabPage7->Name = L"tabPage7";
228
			this->tabPage7->Padding = System::Windows::Forms::Padding(10);
229
			this->tabPage7->Size = System::Drawing::Size(540, 485);
230
			this->tabPage7->TabIndex = 6;
231
			this->tabPage7->Text = L"Guns";
232
			this->tabPage7->UseVisualStyleBackColor = true;
233
			// 
234
			// tabPage6
235
			// 
236
			this->tabPage6->Location = System::Drawing::Point(4, 22);
237
			this->tabPage6->Margin = System::Windows::Forms::Padding(10);
238
			this->tabPage6->Name = L"tabPage6";
239
			this->tabPage6->Padding = System::Windows::Forms::Padding(3);
240
			this->tabPage6->Size = System::Drawing::Size(540, 485);
241
			this->tabPage6->TabIndex = 5;
242
			this->tabPage6->Text = L"Turrets";
243
			this->tabPage6->UseVisualStyleBackColor = true;
244
			// 
245
			// tabPage5
246
			// 
247
			this->tabPage5->Location = System::Drawing::Point(4, 22);
248
			this->tabPage5->Name = L"tabPage5";
249
			this->tabPage5->Padding = System::Windows::Forms::Padding(10);
250
			this->tabPage5->Size = System::Drawing::Size(540, 485);
251
			this->tabPage5->TabIndex = 4;
252
			this->tabPage5->Text = L"Lasers/Missiles";
253
			this->tabPage5->UseVisualStyleBackColor = true;
254
			// 
255
			// tabPage4
256
			// 
257
			this->tabPage4->Location = System::Drawing::Point(4, 22);
258
			this->tabPage4->Name = L"tabPage4";
259
			this->tabPage4->Padding = System::Windows::Forms::Padding(3);
260
			this->tabPage4->Size = System::Drawing::Size(540, 485);
261
			this->tabPage4->TabIndex = 3;
262
			this->tabPage4->Text = L"Model";
263
			this->tabPage4->UseVisualStyleBackColor = true;
264
			// 
265
			// tabPage3
266
			// 
267
			this->tabPage3->Location = System::Drawing::Point(4, 22);
268
			this->tabPage3->Name = L"tabPage3";
269
			this->tabPage3->Padding = System::Windows::Forms::Padding(3);
270
			this->tabPage3->Size = System::Drawing::Size(540, 485);
271
			this->tabPage3->TabIndex = 2;
272
			this->tabPage3->Text = L"Weapons";
273
			this->tabPage3->UseVisualStyleBackColor = true;
274
			// 
275
			// tabPage2
276
			// 
277
			this->tabPage2->Location = System::Drawing::Point(4, 22);
278
			this->tabPage2->Name = L"tabPage2";
279
			this->tabPage2->Padding = System::Windows::Forms::Padding(3);
280
			this->tabPage2->Size = System::Drawing::Size(540, 485);
281
			this->tabPage2->TabIndex = 1;
282
			this->tabPage2->Text = L"Performance";
283
			this->tabPage2->UseVisualStyleBackColor = true;
284
			// 
285
			// tabControl1
286
			// 
287
			this->tabControl1->Controls->Add(this->tabPage1);
288
			this->tabControl1->Controls->Add(this->tabPage2);
289
			this->tabControl1->Controls->Add(this->tabPage3);
290
			this->tabControl1->Controls->Add(this->tabPage4);
291
			this->tabControl1->Controls->Add(this->tabPage5);
292
			this->tabControl1->Controls->Add(this->tabPage6);
293
			this->tabControl1->Controls->Add(this->tabPage7);
294
			this->tabControl1->Dock = System::Windows::Forms::DockStyle::Fill;
295
			this->tabControl1->Location = System::Drawing::Point(10, 42);
296
			this->tabControl1->Name = L"tabControl1";
297
			this->tabControl1->SelectedIndex = 0;
298
			this->tabControl1->Size = System::Drawing::Size(548, 511);
299
			this->tabControl1->TabIndex = 2;
300
			// 
301
			// tabPage1
302
			// 
303
			this->tabPage1->Location = System::Drawing::Point(4, 22);
304
			this->tabPage1->Name = L"tabPage1";
305
			this->tabPage1->Padding = System::Windows::Forms::Padding(3);
306
			this->tabPage1->Size = System::Drawing::Size(540, 485);
307
			this->tabPage1->TabIndex = 0;
308
			this->tabPage1->Text = L"Ship Info";
309
			this->tabPage1->UseVisualStyleBackColor = true;
310
			// 
311
			// CustomiseShip
312
			// 
313
			this->AcceptButton = this->ButSave;
314
			this->AutoScaleDimensions = System::Drawing::SizeF(6, 13);
315
			this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font;
316
			this->CancelButton = this->button2;
317
			this->ClientSize = System::Drawing::Size(568, 609);
318
			this->Controls->Add(this->tabControl1);
319
			this->Controls->Add(this->panel2);
320
			this->Controls->Add(this->panel1);
321
			this->Name = L"CustomiseShip";
322
			this->Padding = System::Windows::Forms::Padding(10);
323
			this->ShowInTaskbar = false;
324
			this->StartPosition = System::Windows::Forms::FormStartPosition::CenterParent;
325
			this->Text = L"Customise Ship";
326
			this->panel1->ResumeLayout(false);
327
			this->panel2->ResumeLayout(false);
328
			this->tabControl1->ResumeLayout(false);
329
			this->ResumeLayout(false);
330
 
331
		}
332
#pragma endregion
333
	private: System::Void ComboGame_SelectedIndexChanged(System::Object^  sender, System::EventArgs^  e) {
334
				 this->SwitchGame();
335
			 }
336
private: System::Void ButSave_Click(System::Object^  sender, System::EventArgs^  e) {
217 cycrow 337
			 m_pShipFile->setCreatedShipData(m_pShipData);
1 cycrow 338
			 for ( SWeaponMasks *m = m_pWeapons->First(); m; m = m_pWeapons->Next() )
339
			 {
340
				 if ( m->iLaserMask > -1 )
341
					 m_pShipFile->SetLaserMask(m->iGame, m->iLaserMask);
342
				 if ( m->iMissileMask > -1 )
343
					 m_pShipFile->SetMissileMask(m->iGame, m->iMissileMask);
344
			 }
345
		 }
346
};
347
}