1 |
cycrow |
1 |
#pragma once
|
|
|
2 |
|
|
|
3 |
using namespace System;
|
|
|
4 |
using namespace System::Xml;
|
|
|
5 |
using namespace System::ComponentModel;
|
|
|
6 |
using namespace System::Collections;
|
|
|
7 |
using namespace System::Windows::Forms;
|
|
|
8 |
using namespace System::Data;
|
|
|
9 |
using namespace System::Drawing;
|
|
|
10 |
|
|
|
11 |
|
|
|
12 |
namespace Creator {
|
|
|
13 |
|
|
|
14 |
/// <summary>
|
|
|
15 |
/// Summary for LoadText
|
|
|
16 |
///
|
|
|
17 |
/// WARNING: If you change the name of this class, you will need to change the
|
|
|
18 |
/// 'Resource File Name' property for the managed resource compiler tool
|
|
|
19 |
/// associated with all .resx files this class depends on. Otherwise,
|
|
|
20 |
/// the designers will not be able to interact properly with localized
|
|
|
21 |
/// resources associated with this form.
|
|
|
22 |
/// </summary>
|
|
|
23 |
public ref class LoadText : public System::Windows::Forms::Form
|
|
|
24 |
{
|
|
|
25 |
public:
|
101 |
cycrow |
26 |
LoadText(CGameDirectories *dirs, bool reload) : _pVFS(NULL),
|
|
|
27 |
_pDirs(dirs),
|
|
|
28 |
_bReload(reload)
|
1 |
cycrow |
29 |
{
|
|
|
30 |
InitializeComponent();
|
|
|
31 |
|
197 |
cycrow |
32 |
_sCurrentDir = new Utils::WString();
|
1 |
cycrow |
33 |
}
|
|
|
34 |
|
101 |
cycrow |
35 |
LoadText(CVirtualFileSystem *vfs) : _pVFS(vfs),
|
|
|
36 |
_pDirs(NULL),
|
|
|
37 |
_bReload(false)
|
|
|
38 |
{
|
|
|
39 |
InitializeComponent();
|
|
|
40 |
|
197 |
cycrow |
41 |
_sCurrentDir = new Utils::WString();
|
101 |
cycrow |
42 |
*_sCurrentDir = vfs->directory();
|
|
|
43 |
}
|
|
|
44 |
|
1 |
cycrow |
45 |
void Start()
|
|
|
46 |
{
|
94 |
cycrow |
47 |
this->label2->Text = _US(*_sCurrentDir);
|
1 |
cycrow |
48 |
this->backgroundWorker1->RunWorkerAsync();
|
|
|
49 |
}
|
|
|
50 |
|
|
|
51 |
void DoWork()
|
|
|
52 |
{
|
94 |
cycrow |
53 |
if ( _sCurrentDir->empty() ) return;
|
101 |
cycrow |
54 |
if ( _pVFS ) _pVFS->updateTexts(0);
|
|
|
55 |
else if ( _pDirs ) _pDirs->updateCurrentVFS(_bReload);
|
1 |
cycrow |
56 |
}
|
|
|
57 |
|
|
|
58 |
void Next()
|
|
|
59 |
{
|
101 |
cycrow |
60 |
if ( _pDirs ) {
|
|
|
61 |
*_sCurrentDir = _pDirs->next();
|
|
|
62 |
if ( !_sCurrentDir->empty() ) {
|
|
|
63 |
this->Start();
|
|
|
64 |
return;
|
|
|
65 |
}
|
|
|
66 |
}
|
|
|
67 |
|
|
|
68 |
this->Close();
|
1 |
cycrow |
69 |
}
|
|
|
70 |
|
|
|
71 |
protected:
|
|
|
72 |
/// <summary>
|
|
|
73 |
/// Clean up any resources being used.
|
|
|
74 |
/// </summary>
|
|
|
75 |
~LoadText()
|
|
|
76 |
{
|
|
|
77 |
if (components)
|
|
|
78 |
{
|
|
|
79 |
delete components;
|
|
|
80 |
}
|
|
|
81 |
}
|
|
|
82 |
private: System::Windows::Forms::Label^ label1;
|
|
|
83 |
protected:
|
|
|
84 |
private: System::Windows::Forms::Label^ label2;
|
|
|
85 |
private: System::ComponentModel::BackgroundWorker^ backgroundWorker1;
|
|
|
86 |
|
|
|
87 |
private:
|
101 |
cycrow |
88 |
bool _bReload;
|
|
|
89 |
CVirtualFileSystem *_pVFS;
|
1 |
cycrow |
90 |
Collections::Hashtable ^m_pTextList;
|
197 |
cycrow |
91 |
Utils::WString *_sCurrentDir;
|
94 |
cycrow |
92 |
CGameDirectories *_pDirs;
|
1 |
cycrow |
93 |
/// <summary>
|
|
|
94 |
/// Required designer variable.
|
|
|
95 |
/// </summary>
|
|
|
96 |
System::ComponentModel::Container ^components;
|
|
|
97 |
|
|
|
98 |
#pragma region Windows Form Designer generated code
|
|
|
99 |
/// <summary>
|
|
|
100 |
/// Required method for Designer support - do not modify
|
|
|
101 |
/// the contents of this method with the code editor.
|
|
|
102 |
/// </summary>
|
|
|
103 |
void InitializeComponent(void)
|
|
|
104 |
{
|
|
|
105 |
this->label1 = (gcnew System::Windows::Forms::Label());
|
|
|
106 |
this->label2 = (gcnew System::Windows::Forms::Label());
|
|
|
107 |
this->backgroundWorker1 = (gcnew System::ComponentModel::BackgroundWorker());
|
|
|
108 |
this->SuspendLayout();
|
|
|
109 |
//
|
|
|
110 |
// label1
|
|
|
111 |
//
|
|
|
112 |
this->label1->Dock = System::Windows::Forms::DockStyle::Top;
|
|
|
113 |
this->label1->Font = (gcnew System::Drawing::Font(L"Microsoft Sans Serif", 12, System::Drawing::FontStyle::Bold, System::Drawing::GraphicsUnit::Point,
|
|
|
114 |
static_cast<System::Byte>(0)));
|
|
|
115 |
this->label1->Location = System::Drawing::Point(10, 10);
|
|
|
116 |
this->label1->Name = L"label1";
|
101 |
cycrow |
117 |
this->label1->Size = System::Drawing::Size(459, 32);
|
1 |
cycrow |
118 |
this->label1->TabIndex = 0;
|
|
|
119 |
this->label1->Text = L"Loading Text";
|
|
|
120 |
this->label1->TextAlign = System::Drawing::ContentAlignment::MiddleCenter;
|
|
|
121 |
this->label1->UseWaitCursor = true;
|
|
|
122 |
//
|
|
|
123 |
// label2
|
|
|
124 |
//
|
|
|
125 |
this->label2->Dock = System::Windows::Forms::DockStyle::Fill;
|
|
|
126 |
this->label2->Font = (gcnew System::Drawing::Font(L"Microsoft Sans Serif", 8.25F, System::Drawing::FontStyle::Italic, System::Drawing::GraphicsUnit::Point,
|
|
|
127 |
static_cast<System::Byte>(0)));
|
|
|
128 |
this->label2->Location = System::Drawing::Point(10, 42);
|
|
|
129 |
this->label2->Name = L"label2";
|
101 |
cycrow |
130 |
this->label2->Size = System::Drawing::Size(459, 23);
|
1 |
cycrow |
131 |
this->label2->TabIndex = 1;
|
|
|
132 |
this->label2->TextAlign = System::Drawing::ContentAlignment::TopCenter;
|
|
|
133 |
this->label2->UseWaitCursor = true;
|
|
|
134 |
//
|
|
|
135 |
// backgroundWorker1
|
|
|
136 |
//
|
|
|
137 |
this->backgroundWorker1->DoWork += gcnew System::ComponentModel::DoWorkEventHandler(this, &LoadText::backgroundWorker1_DoWork);
|
|
|
138 |
this->backgroundWorker1->RunWorkerCompleted += gcnew System::ComponentModel::RunWorkerCompletedEventHandler(this, &LoadText::backgroundWorker1_RunWorkerCompleted);
|
|
|
139 |
//
|
|
|
140 |
// LoadText
|
|
|
141 |
//
|
|
|
142 |
this->AutoScaleDimensions = System::Drawing::SizeF(6, 13);
|
|
|
143 |
this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font;
|
|
|
144 |
this->BackColor = System::Drawing::Color::Gray;
|
101 |
cycrow |
145 |
this->ClientSize = System::Drawing::Size(479, 75);
|
1 |
cycrow |
146 |
this->ControlBox = false;
|
|
|
147 |
this->Controls->Add(this->label2);
|
|
|
148 |
this->Controls->Add(this->label1);
|
|
|
149 |
this->Cursor = System::Windows::Forms::Cursors::WaitCursor;
|
|
|
150 |
this->FormBorderStyle = System::Windows::Forms::FormBorderStyle::None;
|
|
|
151 |
this->Name = L"LoadText";
|
|
|
152 |
this->Padding = System::Windows::Forms::Padding(10);
|
|
|
153 |
this->ShowInTaskbar = false;
|
|
|
154 |
this->SizeGripStyle = System::Windows::Forms::SizeGripStyle::Hide;
|
|
|
155 |
this->StartPosition = System::Windows::Forms::FormStartPosition::CenterParent;
|
|
|
156 |
this->Text = L"LoadText";
|
|
|
157 |
this->TopMost = true;
|
|
|
158 |
this->UseWaitCursor = true;
|
|
|
159 |
this->Load += gcnew System::EventHandler(this, &LoadText::LoadText_Load);
|
|
|
160 |
this->ResumeLayout(false);
|
|
|
161 |
|
|
|
162 |
}
|
|
|
163 |
#pragma endregion
|
|
|
164 |
private: System::Void backgroundWorker1_DoWork(System::Object^ sender, System::ComponentModel::DoWorkEventArgs^ e) {
|
|
|
165 |
this->DoWork();
|
|
|
166 |
}
|
|
|
167 |
private: System::Void LoadText_Load(System::Object^ sender, System::EventArgs^ e) {
|
101 |
cycrow |
168 |
if ( _pDirs )
|
|
|
169 |
*_sCurrentDir = _pDirs->first();
|
1 |
cycrow |
170 |
this->Start();
|
|
|
171 |
}
|
|
|
172 |
private: System::Void backgroundWorker1_RunWorkerCompleted(System::Object^ sender, System::ComponentModel::RunWorkerCompletedEventArgs^ e) {
|
|
|
173 |
this->Next();
|
|
|
174 |
}
|
|
|
175 |
};
|
|
|
176 |
}
|