| 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 |   | 
        
           |  |  | 11 | namespace Creator {
 | 
        
           |  |  | 12 |   | 
        
           |  |  | 13 | 	/// <summary>
 | 
        
           |  |  | 14 | 	/// Summary for LoadShip
 | 
        
           |  |  | 15 | 	///
 | 
        
           |  |  | 16 | 	/// WARNING: If you change the name of this class, you will need to change the
 | 
        
           |  |  | 17 | 	///          'Resource File Name' property for the managed resource compiler tool
 | 
        
           |  |  | 18 | 	///          associated with all .resx files this class depends on.  Otherwise,
 | 
        
           |  |  | 19 | 	///          the designers will not be able to interact properly with localized
 | 
        
           |  |  | 20 | 	///          resources associated with this form.
 | 
        
           |  |  | 21 | 	/// </summary>
 | 
        
           |  |  | 22 | 	public ref class LoadShip : public System::Windows::Forms::Form
 | 
        
           |  |  | 23 | 	{
 | 
        
           |  |  | 24 | 	public:
 | 
        
           |  |  | 25 | 		LoadShip(void)
 | 
        
           |  |  | 26 | 		{
 | 
        
           |  |  | 27 | 			InitializeComponent();
 | 
        
           |  |  | 28 |   | 
        
           |  |  | 29 | 			m_iType = 0;
 | 
        
           |  |  | 30 | 			this->Text = "Select Ship Entry";
 | 
        
           |  |  | 31 | 			m_lData = new CyStringList;
 | 
        
           |  |  | 32 | 			m_iGroup = -1;
 | 
        
           |  |  | 33 | 		}
 | 
        
           |  |  | 34 |   | 
        
           |  |  | 35 | 		void FillData()
 | 
        
           |  |  | 36 | 		{
 | 
        
           |  |  | 37 | 			for ( int i = 0; i < this->ListShip->SelectedItems->Count; i++ )
 | 
        
           |  |  | 38 | 				m_lData->PushBack(CyStringFromSystemString(this->ListShip->SelectedItems[i]->Text), CyStringFromSystemString(this->ListShip->SelectedItems[i]->SubItems[1]->Text));
 | 
        
           |  |  | 39 | 		}
 | 
        
           |  |  | 40 |   | 
        
           |  |  | 41 | 		CyStringList *GetDataList() { return m_lData; }
 | 
        
           |  |  | 42 |   | 
        
           |  |  | 43 | 		void AddGroup(String ^text)
 | 
        
           |  |  | 44 | 		{
 | 
        
           |  |  | 45 | 			ListViewGroup ^group = gcnew ListViewGroup(text, HorizontalAlignment::Left);
 | 
        
           |  |  | 46 | 			this->ListShip->Groups->Add(group);
 | 
        
           |  |  | 47 | 			++m_iGroup;
 | 
        
           |  |  | 48 | 		}
 | 
        
           |  |  | 49 |   | 
        
           |  |  | 50 | 		void AddShip(String ^id, String ^text)
 | 
        
           |  |  | 51 | 		{
 | 
        
           |  |  | 52 | 			ListViewItem ^item = gcnew ListViewItem(id);
 | 
        
           |  |  | 53 | 			item->SubItems->Add(text);
 | 
        
           |  |  | 54 | 			item->ImageIndex = m_iType;
 | 
        
           |  |  | 55 | 			if ( m_iGroup > -1 )
 | 
        
           |  |  | 56 | 				item->Group = this->ListShip->Groups[m_iGroup];
 | 
        
           |  |  | 57 | 			this->ListShip->Items->Add(item);
 | 
        
           |  |  | 58 | 		}
 | 
        
           |  |  | 59 |   | 
        
           |  |  | 60 | 		void Cockpits()
 | 
        
           |  |  | 61 | 		{
 | 
        
           |  |  | 62 | 			m_iType = 1;
 | 
        
           |  |  | 63 | 			this->Text = "Select Cockpit Entries";
 | 
        
           |  |  | 64 | 			this->ListShip->MultiSelect = true;
 | 
        
           |  |  | 65 | 			this->columnHeader2->Width = 0;
 | 
        
           |  |  | 66 | 			this->columnHeader1->Text = "Cockpit ID";
 | 
        
           |  |  | 67 | 		}
 | 
        
           |  |  | 68 | 		void Animations()
 | 
        
           |  |  | 69 | 		{
 | 
        
           |  |  | 70 | 			m_iType = 6;
 | 
        
           |  |  | 71 | 			this->Text = "Select Animation Entries";
 | 
        
           |  |  | 72 | 			this->ListShip->MultiSelect = true;
 | 
        
           |  |  | 73 | 			this->columnHeader2->Width = 0;
 | 
        
           |  |  | 74 | 			this->columnHeader1->Text = "Animations";
 | 
        
           |  |  | 75 | 			this->Width += 200;
 | 
        
           |  |  | 76 | 		}
 | 
        
           |  |  | 77 | 		void Bodies()
 | 
        
           |  |  | 78 | 		{
 | 
        
           |  |  | 79 | 			m_iType = 3;
 | 
        
           |  |  | 80 | 			this->Text = "Select the Bodies entries";
 | 
        
           |  |  | 81 | 			this->ListShip->MultiSelect = true;
 | 
        
           |  |  | 82 | 			this->columnHeader2->Width = 0;
 | 
        
           |  |  | 83 | 			this->columnHeader1->Text = "Bodies";
 | 
        
           |  |  | 84 | 		}
 | 
        
           |  |  | 85 | 		void Dummies()
 | 
        
           |  |  | 86 | 		{
 | 
        
           |  |  | 87 | 			m_iType = 4;
 | 
        
           |  |  | 88 | 			this->Text = "Select the Dummy entries";
 | 
        
           |  |  | 89 | 			this->ListShip->MultiSelect = true;
 | 
        
           |  |  | 90 | 			this->columnHeader2->Width = 0;
 | 
        
           |  |  | 91 | 			this->columnHeader1->Text = "Dummies";
 | 
        
           |  |  | 92 | 			this->Width += 200;
 | 
        
           |  |  | 93 | 		}
 | 
        
           |  |  | 94 | 		void Components()
 | 
        
           |  |  | 95 | 		{
 | 
        
           |  |  | 96 | 			m_iType = 5;
 | 
        
           |  |  | 97 | 			this->Text = "Select the Component entries";
 | 
        
           |  |  | 98 | 			this->ListShip->MultiSelect = true;
 | 
        
           |  |  | 99 | 			this->columnHeader1->Text = "Component";
 | 
        
           |  |  | 100 | 			this->columnHeader2->Text = "Data";
 | 
        
           |  |  | 101 | 			this->Width += 200;
 | 
        
           |  |  | 102 | 		}
 | 
        
           |  |  | 103 | 		void CutData()
 | 
        
           |  |  | 104 | 		{
 | 
        
           |  |  | 105 | 			m_iType = 2;
 | 
        
           |  |  | 106 | 			this->Text = "Select CutData Entries";
 | 
        
           |  |  | 107 | 			this->ListShip->MultiSelect = true;
 | 
        
           |  |  | 108 | 			this->columnHeader1->Text = "Cuts";
 | 
        
           |  |  | 109 | 			this->columnHeader2->Text = "Filename";
 | 
        
           |  |  | 110 | 		}
 | 
        
           |  |  | 111 |   | 
        
           |  |  | 112 | 		String ^GetData() { return m_sData; }
 | 
        
           |  |  | 113 |   | 
        
           |  |  | 114 | 	protected:
 | 
        
           |  |  | 115 | 		/// <summary>
 | 
        
           |  |  | 116 | 		/// Clean up any resources being used.
 | 
        
           |  |  | 117 | 		/// </summary>
 | 
        
           |  |  | 118 | 		~LoadShip()
 | 
        
           |  |  | 119 | 		{
 | 
        
           |  |  | 120 | 			if (components)
 | 
        
           |  |  | 121 | 			{
 | 
        
           |  |  | 122 | 				delete components;
 | 
        
           |  |  | 123 | 			}
 | 
        
           |  |  | 124 | 			delete m_lData;
 | 
        
           |  |  | 125 | 		}
 | 
        
           |  |  | 126 | 	private: System::Windows::Forms::Panel^  panel1;
 | 
        
           |  |  | 127 | 	private: System::Windows::Forms::Button^  button2;
 | 
        
           |  |  | 128 | 	private: System::Windows::Forms::Button^  button1;
 | 
        
           |  |  | 129 | 	private: System::Windows::Forms::ListView^  ListShip;
 | 
        
           |  |  | 130 | 	private: System::Windows::Forms::ColumnHeader^  columnHeader1;
 | 
        
           |  |  | 131 | 	private: System::Windows::Forms::ColumnHeader^  columnHeader2;
 | 
        
           |  |  | 132 | 	private: System::Windows::Forms::ImageList^  imageList1;
 | 
        
           |  |  | 133 | 	private: System::ComponentModel::IContainer^  components;
 | 
        
           |  |  | 134 | 	protected: 
 | 
        
           |  |  | 135 |   | 
        
           |  |  | 136 | 	private:
 | 
        
           |  |  | 137 | 		/// <summary>
 | 
        
           |  |  | 138 | 		/// Required designer variable.
 | 
        
           |  |  | 139 | 		/// </summary>
 | 
        
           |  |  | 140 | 		CyStringList *m_lData;
 | 
        
           |  |  | 141 | 		String ^m_sData;
 | 
        
           |  |  | 142 | 		int		m_iType;
 | 
        
           |  |  | 143 | 		int		m_iGroup;
 | 
        
           |  |  | 144 |   | 
        
           |  |  | 145 |   | 
        
           |  |  | 146 | #pragma region Windows Form Designer generated code
 | 
        
           |  |  | 147 | 		/// <summary>
 | 
        
           |  |  | 148 | 		/// Required method for Designer support - do not modify
 | 
        
           |  |  | 149 | 		/// the contents of this method with the code editor.
 | 
        
           |  |  | 150 | 		/// </summary>
 | 
        
           |  |  | 151 | 		void InitializeComponent(void)
 | 
        
           |  |  | 152 | 		{
 | 
        
           |  |  | 153 | 			this->components = (gcnew System::ComponentModel::Container());
 | 
        
           |  |  | 154 | 			System::ComponentModel::ComponentResourceManager^  resources = (gcnew System::ComponentModel::ComponentResourceManager(LoadShip::typeid));
 | 
        
           |  |  | 155 | 			this->panel1 = (gcnew System::Windows::Forms::Panel());
 | 
        
           |  |  | 156 | 			this->button2 = (gcnew System::Windows::Forms::Button());
 | 
        
           |  |  | 157 | 			this->button1 = (gcnew System::Windows::Forms::Button());
 | 
        
           |  |  | 158 | 			this->ListShip = (gcnew System::Windows::Forms::ListView());
 | 
        
           |  |  | 159 | 			this->columnHeader1 = (gcnew System::Windows::Forms::ColumnHeader());
 | 
        
           |  |  | 160 | 			this->columnHeader2 = (gcnew System::Windows::Forms::ColumnHeader());
 | 
        
           |  |  | 161 | 			this->imageList1 = (gcnew System::Windows::Forms::ImageList(this->components));
 | 
        
           |  |  | 162 | 			this->panel1->SuspendLayout();
 | 
        
           |  |  | 163 | 			this->SuspendLayout();
 | 
        
           |  |  | 164 | 			// 
 | 
        
           |  |  | 165 | 			// panel1
 | 
        
           |  |  | 166 | 			// 
 | 
        
           |  |  | 167 | 			this->panel1->Controls->Add(this->button2);
 | 
        
           |  |  | 168 | 			this->panel1->Controls->Add(this->button1);
 | 
        
           |  |  | 169 | 			this->panel1->Dock = System::Windows::Forms::DockStyle::Bottom;
 | 
        
           |  |  | 170 | 			this->panel1->Location = System::Drawing::Point(10, 500);
 | 
        
           |  |  | 171 | 			this->panel1->Name = L"panel1";
 | 
        
           |  |  | 172 | 			this->panel1->Padding = System::Windows::Forms::Padding(5);
 | 
        
           |  |  | 173 | 			this->panel1->Size = System::Drawing::Size(383, 43);
 | 
        
           |  |  | 174 | 			this->panel1->TabIndex = 0;
 | 
        
           |  |  | 175 | 			// 
 | 
        
           |  |  | 176 | 			// button2
 | 
        
           |  |  | 177 | 			// 
 | 
        
           |  |  | 178 | 			this->button2->DialogResult = System::Windows::Forms::DialogResult::Cancel;
 | 
        
           |  |  | 179 | 			this->button2->Dock = System::Windows::Forms::DockStyle::Right;
 | 
        
           |  |  | 180 | 			this->button2->Location = System::Drawing::Point(197, 5);
 | 
        
           |  |  | 181 | 			this->button2->Name = L"button2";
 | 
        
           |  |  | 182 | 			this->button2->Size = System::Drawing::Size(91, 33);
 | 
        
           |  |  | 183 | 			this->button2->TabIndex = 1;
 | 
        
           |  |  | 184 | 			this->button2->Text = L"Cancel";
 | 
        
           |  |  | 185 | 			this->button2->UseVisualStyleBackColor = true;
 | 
        
           |  |  | 186 | 			// 
 | 
        
           |  |  | 187 | 			// button1
 | 
        
           |  |  | 188 | 			// 
 | 
        
           |  |  | 189 | 			this->button1->DialogResult = System::Windows::Forms::DialogResult::OK;
 | 
        
           |  |  | 190 | 			this->button1->Dock = System::Windows::Forms::DockStyle::Right;
 | 
        
           |  |  | 191 | 			this->button1->Enabled = false;
 | 
        
           |  |  | 192 | 			this->button1->Location = System::Drawing::Point(288, 5);
 | 
        
           |  |  | 193 | 			this->button1->Name = L"button1";
 | 
        
           |  |  | 194 | 			this->button1->Size = System::Drawing::Size(90, 33);
 | 
        
           |  |  | 195 | 			this->button1->TabIndex = 0;
 | 
        
           |  |  | 196 | 			this->button1->Text = L"OK";
 | 
        
           |  |  | 197 | 			this->button1->UseVisualStyleBackColor = true;
 | 
        
           |  |  | 198 | 			this->button1->Click += gcnew System::EventHandler(this, &LoadShip::button1_Click);
 | 
        
           |  |  | 199 | 			// 
 | 
        
           |  |  | 200 | 			// ListShip
 | 
        
           |  |  | 201 | 			// 
 | 
        
           |  |  | 202 | 			this->ListShip->Columns->AddRange(gcnew cli::array< System::Windows::Forms::ColumnHeader^  >(2) {this->columnHeader1, this->columnHeader2});
 | 
        
           |  |  | 203 | 			this->ListShip->Dock = System::Windows::Forms::DockStyle::Fill;
 | 
        
           |  |  | 204 | 			this->ListShip->FullRowSelect = true;
 | 
        
           |  |  | 205 | 			this->ListShip->LargeImageList = this->imageList1;
 | 
        
           |  |  | 206 | 			this->ListShip->Location = System::Drawing::Point(10, 10);
 | 
        
           |  |  | 207 | 			this->ListShip->Name = L"ListShip";
 | 
        
           |  |  | 208 | 			this->ListShip->Size = System::Drawing::Size(383, 490);
 | 
        
           |  |  | 209 | 			this->ListShip->SmallImageList = this->imageList1;
 | 
        
           |  |  | 210 | 			this->ListShip->TabIndex = 1;
 | 
        
           |  |  | 211 | 			this->ListShip->UseCompatibleStateImageBehavior = false;
 | 
        
           |  |  | 212 | 			this->ListShip->View = System::Windows::Forms::View::Details;
 | 
        
           |  |  | 213 | 			this->ListShip->MouseDoubleClick += gcnew System::Windows::Forms::MouseEventHandler(this, &LoadShip::ListShip_MouseDoubleClick);
 | 
        
           |  |  | 214 | 			this->ListShip->SelectedIndexChanged += gcnew System::EventHandler(this, &LoadShip::ListShip_SelectedIndexChanged);
 | 
        
           |  |  | 215 | 			// 
 | 
        
           |  |  | 216 | 			// columnHeader1
 | 
        
           |  |  | 217 | 			// 
 | 
        
           |  |  | 218 | 			this->columnHeader1->Text = L"Ship ID";
 | 
        
           |  |  | 219 | 			// 
 | 
        
           |  |  | 220 | 			// columnHeader2
 | 
        
           |  |  | 221 | 			// 
 | 
        
           |  |  | 222 | 			this->columnHeader2->Text = L"Ship Text";
 | 
        
           |  |  | 223 | 			// 
 | 
        
           |  |  | 224 | 			// imageList1
 | 
        
           |  |  | 225 | 			// 
 | 
        
           |  |  | 226 | 			this->imageList1->ImageStream = (cli::safe_cast<System::Windows::Forms::ImageListStreamer^  >(resources->GetObject(L"imageList1.ImageStream")));
 | 
        
           |  |  | 227 | 			this->imageList1->TransparentColor = System::Drawing::Color::Transparent;
 | 
        
           |  |  | 228 | 			this->imageList1->Images->SetKeyName(0, L"drak-icon.png");
 | 
        
           |  |  | 229 | 			this->imageList1->Images->SetKeyName(1, L"redhat-games.png");
 | 
        
           |  |  | 230 | 			this->imageList1->Images->SetKeyName(2, L"gnome-fs-bookmark-missing.png");
 | 
        
           |  |  | 231 | 			this->imageList1->Images->SetKeyName(3, L"users.png");
 | 
        
           |  |  | 232 | 			this->imageList1->Images->SetKeyName(4, L"nobody.png");
 | 
        
           |  |  | 233 | 			this->imageList1->Images->SetKeyName(5, L"redhat-accessories.png");
 | 
        
           |  |  | 234 | 			this->imageList1->Images->SetKeyName(6, L"tvtime.png");
 | 
        
           |  |  | 235 | 			// 
 | 
        
           |  |  | 236 | 			// LoadShip
 | 
        
           |  |  | 237 | 			// 
 | 
        
           |  |  | 238 | 			this->AcceptButton = this->button1;
 | 
        
           |  |  | 239 | 			this->AutoScaleDimensions = System::Drawing::SizeF(6, 13);
 | 
        
           |  |  | 240 | 			this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font;
 | 
        
           |  |  | 241 | 			this->CancelButton = this->button2;
 | 
        
           |  |  | 242 | 			this->ClientSize = System::Drawing::Size(403, 553);
 | 
        
           |  |  | 243 | 			this->ControlBox = false;
 | 
        
           |  |  | 244 | 			this->Controls->Add(this->ListShip);
 | 
        
           |  |  | 245 | 			this->Controls->Add(this->panel1);
 | 
        
           |  |  | 246 | 			this->Name = L"LoadShip";
 | 
        
           |  |  | 247 | 			this->Padding = System::Windows::Forms::Padding(10);
 | 
        
           |  |  | 248 | 			this->StartPosition = System::Windows::Forms::FormStartPosition::CenterParent;
 | 
        
           |  |  | 249 | 			this->Text = L"LoadShip";
 | 
        
           |  |  | 250 | 			this->Load += gcnew System::EventHandler(this, &LoadShip::LoadShip_Load);
 | 
        
           |  |  | 251 | 			this->panel1->ResumeLayout(false);
 | 
        
           |  |  | 252 | 			this->ResumeLayout(false);
 | 
        
           |  |  | 253 |   | 
        
           |  |  | 254 | 		}
 | 
        
           |  |  | 255 | #pragma endregion
 | 
        
           |  |  | 256 | 	private: System::Void LoadShip_Load(System::Object^  sender, System::EventArgs^  e) {
 | 
        
           |  |  | 257 | 				this->ListShip->AutoResizeColumns(ColumnHeaderAutoResizeStyle::HeaderSize);
 | 
        
           |  |  | 258 | 				if ( m_iType == 1 || m_iType == 3 || m_iType == 4 || m_iType == 6 )
 | 
        
           |  |  | 259 | 					this->columnHeader2->Width = 0;
 | 
        
           |  |  | 260 | 				this->ListShip->Focus();
 | 
        
           |  |  | 261 | 			 }
 | 
        
           |  |  | 262 | private: System::Void ListShip_MouseDoubleClick(System::Object^  sender, System::Windows::Forms::MouseEventArgs^  e) {
 | 
        
           |  |  | 263 | 			if ( this->ListShip->SelectedItems->Count )
 | 
        
           |  |  | 264 | 			{
 | 
        
           |  |  | 265 | 				m_sData = this->ListShip->SelectedItems[0]->Text;
 | 
        
           |  |  | 266 | 				this->FillData();
 | 
        
           |  |  | 267 | 				this->DialogResult = System::Windows::Forms::DialogResult::OK;
 | 
        
           |  |  | 268 | 				this->Close();
 | 
        
           |  |  | 269 | 			}
 | 
        
           |  |  | 270 | 		 }
 | 
        
           |  |  | 271 | private: System::Void button1_Click(System::Object^  sender, System::EventArgs^  e) {
 | 
        
           |  |  | 272 | 			if ( this->ListShip->SelectedItems->Count )
 | 
        
           |  |  | 273 | 			{
 | 
        
           |  |  | 274 | 				m_sData = this->ListShip->SelectedItems[0]->Text;
 | 
        
           |  |  | 275 | 				this->FillData();
 | 
        
           |  |  | 276 | 				this->DialogResult = System::Windows::Forms::DialogResult::OK;
 | 
        
           |  |  | 277 | 				this->Close();
 | 
        
           |  |  | 278 | 			}
 | 
        
           |  |  | 279 | 		 }
 | 
        
           |  |  | 280 | private: System::Void ListShip_SelectedIndexChanged(System::Object^  sender, System::EventArgs^  e) {
 | 
        
           |  |  | 281 | 			 this->button1->Enabled = (this->ListShip->SelectedItems->Count) ? true : false;
 | 
        
           |  |  | 282 | 		 }
 | 
        
           |  |  | 283 | };
 | 
        
           |  |  | 284 | }
 |