Rev 160 | Blame | Compare with Previous | Last modification | View Log | RSS feed
#pragma once#include <spk.h>using namespace System;using namespace System::ComponentModel;using namespace System::Collections;using namespace System::Windows::Forms;using namespace System::Data;using namespace System::Drawing;namespace PluginManager {/// <summary>/// Summary for FakePatchControl////// WARNING: If you change the name of this class, you will need to change the/// 'Resource File Name' property for the managed resource compiler tool/// associated with all .resx files this class depends on. Otherwise,/// the designers will not be able to interact properly with localized/// resources associated with this form./// </summary>public ref class FakePatchControl : public System::Windows::Forms::Form{public:FakePatchControl(CPackages *p){InitializeComponent();m_pPackages = p;m_lFakePatches = new Utils::WStringList;this->panel2->Visible = false;UpdateList();ApplyOrder();}Utils::WStringList *GetPatchOrder() { return m_lFakePatches; }void UpdateList();void ApplyOrder();void Save();void Unorder(ListViewItem ^item){this->listView2->Items->Remove(item);this->listView1->Items->Add(item);item->ImageIndex = 1;this->listView1->AutoResizeColumns(ColumnHeaderAutoResizeStyle::HeaderSize);this->listView2->AutoResizeColumns(ColumnHeaderAutoResizeStyle::HeaderSize);}void Order(ListViewItem ^item){this->listView1->Items->Remove(item);this->listView2->Items->Add(item);item->Selected = true;item->ImageIndex = 0;this->listView1->AutoResizeColumns(ColumnHeaderAutoResizeStyle::HeaderSize);this->listView2->AutoResizeColumns(ColumnHeaderAutoResizeStyle::HeaderSize);}protected:/// <summary>/// Clean up any resources being used./// </summary>~FakePatchControl(){if (components){delete components;}delete m_lFakePatches;}private:Utils::WStringList *m_lFakePatches;CPackages *m_pPackages;ListViewItem ^m_pSelectedItem;private: System::Windows::Forms::ImageList^ imageList1;private: System::Windows::Forms::Panel^ panel1;private: System::Windows::Forms::Button^ button2;private: System::Windows::Forms::Button^ button1;private: System::Windows::Forms::SplitContainer^ splitContainer1;private: System::Windows::Forms::ListView^ listView2;private: System::Windows::Forms::ColumnHeader^ columnHeader4;private: System::Windows::Forms::ListView^ listView1;private: System::Windows::Forms::ColumnHeader^ columnHeader2;private: System::Windows::Forms::ContextMenuStrip^ contextMenuStrip1;private: System::Windows::Forms::ToolStripMenuItem^ moveToTopToolStripMenuItem;private: System::Windows::Forms::ToolStripMenuItem^ moveUpToolStripMenuItem;private: System::Windows::Forms::ToolStripMenuItem^ moveDownToolStripMenuItem;private: System::Windows::Forms::ToolStripMenuItem^ moveToBottomToolStripMenuItem;private: System::Windows::Forms::ToolStripSeparator^ toolStripSeparator1;private: System::Windows::Forms::ToolStripMenuItem^ removeToolStripMenuItem;private: System::Windows::Forms::Panel^ panel2;private: System::Windows::Forms::Button^ button6;private: System::Windows::Forms::Button^ button5;private: System::Windows::Forms::Button^ button4;private: System::Windows::Forms::Button^ button3;private: System::Windows::Forms::Button^ button7;private: System::ComponentModel::IContainer^ components;/// <summary>/// Required designer variable./// </summary>#pragma region Windows Form Designer generated code/// <summary>/// Required method for Designer support - do not modify/// the contents of this method with the code editor./// </summary>void InitializeComponent(void){this->components = (gcnew System::ComponentModel::Container());System::ComponentModel::ComponentResourceManager^ resources = (gcnew System::ComponentModel::ComponentResourceManager(FakePatchControl::typeid));this->imageList1 = (gcnew System::Windows::Forms::ImageList(this->components));this->panel1 = (gcnew System::Windows::Forms::Panel());this->button2 = (gcnew System::Windows::Forms::Button());this->button1 = (gcnew System::Windows::Forms::Button());this->splitContainer1 = (gcnew System::Windows::Forms::SplitContainer());this->listView2 = (gcnew System::Windows::Forms::ListView());this->columnHeader4 = (gcnew System::Windows::Forms::ColumnHeader());this->contextMenuStrip1 = (gcnew System::Windows::Forms::ContextMenuStrip(this->components));this->moveToTopToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());this->moveUpToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());this->moveDownToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());this->moveToBottomToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());this->toolStripSeparator1 = (gcnew System::Windows::Forms::ToolStripSeparator());this->removeToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());this->panel2 = (gcnew System::Windows::Forms::Panel());this->button7 = (gcnew System::Windows::Forms::Button());this->button6 = (gcnew System::Windows::Forms::Button());this->button5 = (gcnew System::Windows::Forms::Button());this->button4 = (gcnew System::Windows::Forms::Button());this->button3 = (gcnew System::Windows::Forms::Button());this->listView1 = (gcnew System::Windows::Forms::ListView());this->columnHeader2 = (gcnew System::Windows::Forms::ColumnHeader());this->panel1->SuspendLayout();this->splitContainer1->Panel1->SuspendLayout();this->splitContainer1->Panel2->SuspendLayout();this->splitContainer1->SuspendLayout();this->contextMenuStrip1->SuspendLayout();this->panel2->SuspendLayout();this->SuspendLayout();//// imageList1//this->imageList1->ImageStream = (cli::safe_cast<System::Windows::Forms::ImageListStreamer^ >(resources->GetObject(L"imageList1.ImageStream")));this->imageList1->TransparentColor = System::Drawing::Color::Transparent;this->imageList1->Images->SetKeyName(0, L"X3TC.ico");this->imageList1->Images->SetKeyName(1, L"X3.ico");this->imageList1->Images->SetKeyName(2, L"up.png");this->imageList1->Images->SetKeyName(3, L"database_up.png");this->imageList1->Images->SetKeyName(4, L"database_down.png");this->imageList1->Images->SetKeyName(5, L"down.png");this->imageList1->Images->SetKeyName(6, L"remove.png");//// panel1//this->panel1->Controls->Add(this->button2);this->panel1->Controls->Add(this->button1);this->panel1->Dock = System::Windows::Forms::DockStyle::Bottom;this->panel1->Location = System::Drawing::Point(0, 404);this->panel1->Name = L"panel1";this->panel1->Padding = System::Windows::Forms::Padding(5);this->panel1->Size = System::Drawing::Size(482, 37);this->panel1->TabIndex = 0;//// button2//this->button2->DialogResult = System::Windows::Forms::DialogResult::Cancel;this->button2->Dock = System::Windows::Forms::DockStyle::Right;this->button2->Location = System::Drawing::Point(327, 5);this->button2->Name = L"button2";this->button2->Size = System::Drawing::Size(75, 27);this->button2->TabIndex = 1;this->button2->Text = L"Cancel";this->button2->UseVisualStyleBackColor = true;//// button1//this->button1->DialogResult = System::Windows::Forms::DialogResult::OK;this->button1->Dock = System::Windows::Forms::DockStyle::Right;this->button1->Location = System::Drawing::Point(402, 5);this->button1->Name = L"button1";this->button1->Size = System::Drawing::Size(75, 27);this->button1->TabIndex = 0;this->button1->Text = L"Save";this->button1->UseVisualStyleBackColor = true;this->button1->Click += gcnew System::EventHandler(this, &FakePatchControl::button1_Click);//// splitContainer1//this->splitContainer1->Dock = System::Windows::Forms::DockStyle::Fill;this->splitContainer1->Location = System::Drawing::Point(0, 0);this->splitContainer1->Name = L"splitContainer1";this->splitContainer1->Orientation = System::Windows::Forms::Orientation::Horizontal;//// splitContainer1.Panel1//this->splitContainer1->Panel1->Controls->Add(this->listView2);this->splitContainer1->Panel1->Controls->Add(this->panel2);//// splitContainer1.Panel2//this->splitContainer1->Panel2->Controls->Add(this->listView1);this->splitContainer1->Size = System::Drawing::Size(482, 404);this->splitContainer1->SplitterDistance = 219;this->splitContainer1->TabIndex = 2;//// listView2//this->listView2->Columns->AddRange(gcnew cli::array< System::Windows::Forms::ColumnHeader^ >(1) {this->columnHeader4});this->listView2->ContextMenuStrip = this->contextMenuStrip1;this->listView2->Dock = System::Windows::Forms::DockStyle::Fill;this->listView2->FullRowSelect = true;this->listView2->HideSelection = false;this->listView2->LargeImageList = this->imageList1;this->listView2->Location = System::Drawing::Point(0, 0);this->listView2->MultiSelect = false;this->listView2->Name = L"listView2";this->listView2->Size = System::Drawing::Size(447, 219);this->listView2->SmallImageList = this->imageList1;this->listView2->TabIndex = 2;this->listView2->UseCompatibleStateImageBehavior = false;this->listView2->View = System::Windows::Forms::View::Details;this->listView2->MouseDoubleClick += gcnew System::Windows::Forms::MouseEventHandler(this, &FakePatchControl::listView2_MouseDoubleClick);this->listView2->ItemSelectionChanged += gcnew System::Windows::Forms::ListViewItemSelectionChangedEventHandler(this, &FakePatchControl::listView2_ItemSelectionChanged);//// columnHeader4//this->columnHeader4->Text = L"Ordered Packages";//// contextMenuStrip1//this->contextMenuStrip1->Items->AddRange(gcnew cli::array< System::Windows::Forms::ToolStripItem^ >(6) {this->moveToTopToolStripMenuItem,this->moveUpToolStripMenuItem, this->moveDownToolStripMenuItem, this->moveToBottomToolStripMenuItem, this->toolStripSeparator1,this->removeToolStripMenuItem});this->contextMenuStrip1->Name = L"contextMenuStrip1";this->contextMenuStrip1->Size = System::Drawing::Size(162, 120);this->contextMenuStrip1->Opening += gcnew System::ComponentModel::CancelEventHandler(this, &FakePatchControl::contextMenuStrip1_Opening);//// moveToTopToolStripMenuItem//this->moveToTopToolStripMenuItem->Image = (cli::safe_cast<System::Drawing::Image^ >(resources->GetObject(L"moveToTopToolStripMenuItem.Image")));this->moveToTopToolStripMenuItem->Name = L"moveToTopToolStripMenuItem";this->moveToTopToolStripMenuItem->Size = System::Drawing::Size(161, 22);this->moveToTopToolStripMenuItem->Text = L"Move to Top";this->moveToTopToolStripMenuItem->Click += gcnew System::EventHandler(this, &FakePatchControl::moveToTopToolStripMenuItem_Click);//// moveUpToolStripMenuItem//this->moveUpToolStripMenuItem->Image = (cli::safe_cast<System::Drawing::Image^ >(resources->GetObject(L"moveUpToolStripMenuItem.Image")));this->moveUpToolStripMenuItem->Name = L"moveUpToolStripMenuItem";this->moveUpToolStripMenuItem->Size = System::Drawing::Size(161, 22);this->moveUpToolStripMenuItem->Text = L"Move Up";this->moveUpToolStripMenuItem->Click += gcnew System::EventHandler(this, &FakePatchControl::moveUpToolStripMenuItem_Click);//// moveDownToolStripMenuItem//this->moveDownToolStripMenuItem->Image = (cli::safe_cast<System::Drawing::Image^ >(resources->GetObject(L"moveDownToolStripMenuItem.Image")));this->moveDownToolStripMenuItem->Name = L"moveDownToolStripMenuItem";this->moveDownToolStripMenuItem->Size = System::Drawing::Size(161, 22);this->moveDownToolStripMenuItem->Text = L"Move Down";this->moveDownToolStripMenuItem->Click += gcnew System::EventHandler(this, &FakePatchControl::moveDownToolStripMenuItem_Click);//// moveToBottomToolStripMenuItem//this->moveToBottomToolStripMenuItem->Image = (cli::safe_cast<System::Drawing::Image^ >(resources->GetObject(L"moveToBottomToolStripMenuItem.Image")));this->moveToBottomToolStripMenuItem->Name = L"moveToBottomToolStripMenuItem";this->moveToBottomToolStripMenuItem->Size = System::Drawing::Size(161, 22);this->moveToBottomToolStripMenuItem->Text = L"Move to Bottom";this->moveToBottomToolStripMenuItem->Click += gcnew System::EventHandler(this, &FakePatchControl::moveToBottomToolStripMenuItem_Click);//// toolStripSeparator1//this->toolStripSeparator1->Name = L"toolStripSeparator1";this->toolStripSeparator1->Size = System::Drawing::Size(158, 6);//// removeToolStripMenuItem//this->removeToolStripMenuItem->Image = (cli::safe_cast<System::Drawing::Image^ >(resources->GetObject(L"removeToolStripMenuItem.Image")));this->removeToolStripMenuItem->Name = L"removeToolStripMenuItem";this->removeToolStripMenuItem->Size = System::Drawing::Size(161, 22);this->removeToolStripMenuItem->Text = L"Set Unsorted";this->removeToolStripMenuItem->Click += gcnew System::EventHandler(this, &FakePatchControl::removeToolStripMenuItem_Click);//// panel2//this->panel2->Controls->Add(this->button7);this->panel2->Controls->Add(this->button6);this->panel2->Controls->Add(this->button5);this->panel2->Controls->Add(this->button4);this->panel2->Controls->Add(this->button3);this->panel2->Dock = System::Windows::Forms::DockStyle::Right;this->panel2->Location = System::Drawing::Point(447, 0);this->panel2->Name = L"panel2";this->panel2->Size = System::Drawing::Size(35, 219);this->panel2->TabIndex = 3;//// button7//this->button7->Dock = System::Windows::Forms::DockStyle::Fill;this->button7->ImageIndex = 6;this->button7->ImageList = this->imageList1;this->button7->Location = System::Drawing::Point(0, 67);this->button7->Name = L"button7";this->button7->Size = System::Drawing::Size(35, 86);this->button7->TabIndex = 4;this->button7->UseVisualStyleBackColor = true;this->button7->Click += gcnew System::EventHandler(this, &FakePatchControl::button7_Click);//// button6//this->button6->Dock = System::Windows::Forms::DockStyle::Bottom;this->button6->ImageKey = L"down.png";this->button6->ImageList = this->imageList1;this->button6->Location = System::Drawing::Point(0, 153);this->button6->Name = L"button6";this->button6->Size = System::Drawing::Size(35, 33);this->button6->TabIndex = 3;this->button6->UseVisualStyleBackColor = true;this->button6->Click += gcnew System::EventHandler(this, &FakePatchControl::button6_Click);//// button5//this->button5->Dock = System::Windows::Forms::DockStyle::Bottom;this->button5->ImageIndex = 4;this->button5->ImageList = this->imageList1;this->button5->Location = System::Drawing::Point(0, 186);this->button5->Name = L"button5";this->button5->Size = System::Drawing::Size(35, 33);this->button5->TabIndex = 2;this->button5->UseVisualStyleBackColor = true;this->button5->Click += gcnew System::EventHandler(this, &FakePatchControl::button5_Click);//// button4//this->button4->Dock = System::Windows::Forms::DockStyle::Top;this->button4->ImageIndex = 2;this->button4->ImageList = this->imageList1;this->button4->Location = System::Drawing::Point(0, 33);this->button4->Name = L"button4";this->button4->Size = System::Drawing::Size(35, 34);this->button4->TabIndex = 1;this->button4->UseVisualStyleBackColor = true;this->button4->Click += gcnew System::EventHandler(this, &FakePatchControl::button4_Click);//// button3//this->button3->Dock = System::Windows::Forms::DockStyle::Top;this->button3->ImageIndex = 3;this->button3->ImageList = this->imageList1;this->button3->Location = System::Drawing::Point(0, 0);this->button3->Name = L"button3";this->button3->Size = System::Drawing::Size(35, 33);this->button3->TabIndex = 0;this->button3->UseVisualStyleBackColor = true;this->button3->Click += gcnew System::EventHandler(this, &FakePatchControl::button3_Click);//// listView1//this->listView1->Columns->AddRange(gcnew cli::array< System::Windows::Forms::ColumnHeader^ >(1) {this->columnHeader2});this->listView1->Dock = System::Windows::Forms::DockStyle::Fill;this->listView1->FullRowSelect = true;this->listView1->LargeImageList = this->imageList1;this->listView1->Location = System::Drawing::Point(0, 0);this->listView1->MultiSelect = false;this->listView1->Name = L"listView1";this->listView1->Size = System::Drawing::Size(482, 181);this->listView1->SmallImageList = this->imageList1;this->listView1->TabIndex = 1;this->listView1->UseCompatibleStateImageBehavior = false;this->listView1->View = System::Windows::Forms::View::Details;this->listView1->MouseDoubleClick += gcnew System::Windows::Forms::MouseEventHandler(this, &FakePatchControl::listView1_MouseDoubleClick);//// columnHeader2//this->columnHeader2->Text = L"Unsorted Packages";//// FakePatchControl//this->AcceptButton = this->button1;this->AutoScaleDimensions = System::Drawing::SizeF(6, 13);this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font;this->CancelButton = this->button2;this->ClientSize = System::Drawing::Size(482, 441);this->Controls->Add(this->splitContainer1);this->Controls->Add(this->panel1);this->Name = L"FakePatchControl";this->StartPosition = System::Windows::Forms::FormStartPosition::CenterParent;this->Text = L"Fake Patch Control";this->TopMost = true;this->panel1->ResumeLayout(false);this->splitContainer1->Panel1->ResumeLayout(false);this->splitContainer1->Panel2->ResumeLayout(false);this->splitContainer1->ResumeLayout(false);this->contextMenuStrip1->ResumeLayout(false);this->panel2->ResumeLayout(false);this->ResumeLayout(false);}#pragma endregionprivate: System::Void listView1_MouseDoubleClick(System::Object^ sender, System::Windows::Forms::MouseEventArgs^ e) {Point ^mousePoint = this->listView1->PointToClient(this->listView1->MousePosition);ListViewItem ^item = this->listView1->GetItemAt(mousePoint->X, mousePoint->Y);if ( item )Order(item);}private: System::Void contextMenuStrip1_Opening(System::Object^ sender, System::ComponentModel::CancelEventArgs^ e) {Point ^mousePoint = this->listView2->PointToClient(this->contextMenuStrip1->MousePosition);ListViewItem ^item = this->listView2->GetItemAt(mousePoint->X, mousePoint->Y);m_pSelectedItem = item;if ( !item )e->Cancel = true;else{// already at the topif ( this->listView2->Items->IndexOf(item) == 0 ){this->moveToTopToolStripMenuItem->Enabled = false;this->moveUpToolStripMenuItem->Enabled = false;}else{this->moveToTopToolStripMenuItem->Enabled = true;this->moveUpToolStripMenuItem->Enabled = true;}// already at the bottomif ( this->listView2->Items->IndexOf(item) == (this->listView2->Items->Count - 1) ){this->moveToBottomToolStripMenuItem->Enabled = false;this->moveDownToolStripMenuItem->Enabled = false;}else{this->moveToBottomToolStripMenuItem->Enabled = true;this->moveDownToolStripMenuItem->Enabled = true;}}}private: System::Void removeToolStripMenuItem_Click(System::Object^ sender, System::EventArgs^ e) {if ( !m_pSelectedItem ) return;Unorder(m_pSelectedItem);}private: System::Void listView2_MouseDoubleClick(System::Object^ sender, System::Windows::Forms::MouseEventArgs^ e) {Point ^mousePoint = this->listView2->PointToClient(this->listView2->MousePosition);ListViewItem ^item = this->listView2->GetItemAt(mousePoint->X, mousePoint->Y);if ( item )Unorder(item);}private: System::Void moveToTopToolStripMenuItem_Click(System::Object^ sender, System::EventArgs^ e) {if ( !m_pSelectedItem ) return;// remove item and insert it in correct placesthis->listView2->Items->Remove(m_pSelectedItem);this->listView2->Items->Insert(0, m_pSelectedItem);}private: System::Void moveToBottomToolStripMenuItem_Click(System::Object^ sender, System::EventArgs^ e) {if ( !m_pSelectedItem ) return;// remove item and insert it in correct placesthis->listView2->Items->Remove(m_pSelectedItem);this->listView2->Items->Add(m_pSelectedItem);}private: System::Void moveUpToolStripMenuItem_Click(System::Object^ sender, System::EventArgs^ e) {if ( !m_pSelectedItem ) return;int idx = m_pSelectedItem->Index;this->listView2->Items->Remove(m_pSelectedItem);this->listView2->Items->Insert(idx - 1, m_pSelectedItem);}private: System::Void moveDownToolStripMenuItem_Click(System::Object^ sender, System::EventArgs^ e) {if ( !m_pSelectedItem ) return;int idx = m_pSelectedItem->Index;this->listView2->Items->Remove(m_pSelectedItem);this->listView2->Items->Insert(idx + 1, m_pSelectedItem);}private: System::Void listView2_ItemSelectionChanged(System::Object^ sender, System::Windows::Forms::ListViewItemSelectionChangedEventArgs^ e) {if ( this->listView2->SelectedItems->Count ){ListViewItem ^item = this->listView2->SelectedItems[0];if ( item->Index == 0 ){this->button3->Enabled = false;this->button4->Enabled = false;}else{this->button3->Enabled = true;this->button4->Enabled = true;}if ( item->Index == (this->listView2->Items->Count - 1) ){this->button5->Enabled = false;this->button6->Enabled = false;}else{this->button5->Enabled = true;this->button6->Enabled = true;}this->panel2->Visible = true;}elsethis->panel2->Visible = false;}private: System::Void button3_Click(System::Object^ sender, System::EventArgs^ e) {if ( !this->listView2->SelectedItems->Count ) return;ListViewItem ^item = this->listView2->SelectedItems[0];this->listView2->Items->Remove(item);this->listView2->Items->Insert(0, item);}private: System::Void button4_Click(System::Object^ sender, System::EventArgs^ e) {if ( !this->listView2->SelectedItems->Count ) return;ListViewItem ^item = this->listView2->SelectedItems[0];int idx = item->Index;this->listView2->Items->Remove(item);this->listView2->Items->Insert(idx - 1, item);}private: System::Void button7_Click(System::Object^ sender, System::EventArgs^ e) {if ( this->listView2->SelectedItems->Count )Unorder(this->listView2->SelectedItems[0]);}private: System::Void button6_Click(System::Object^ sender, System::EventArgs^ e) {if ( !this->listView2->SelectedItems->Count ) return;ListViewItem ^item = this->listView2->SelectedItems[0];int idx = item->Index;this->listView2->Items->Remove(item);this->listView2->Items->Insert(idx + 1, item);}private: System::Void button5_Click(System::Object^ sender, System::EventArgs^ e) {if ( !this->listView2->SelectedItems->Count ) return;ListViewItem ^item = this->listView2->SelectedItems[0];this->listView2->Items->Remove(item);this->listView2->Items->Add(item);}private: System::Void button1_Click(System::Object^ sender, System::EventArgs^ e) {// save the fake patch orderSave();}};}