Subversion Repositories spk

Rev

Rev 94 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 94 Rev 101
Line 21... Line 21...
21
	///          resources associated with this form.
21
	///          resources associated with this form.
22
	/// </summary>
22
	/// </summary>
23
	public ref class LoadText : public System::Windows::Forms::Form
23
	public ref class LoadText : public System::Windows::Forms::Form
24
	{
24
	{
25
	public:
25
	public:
26
		LoadText(CGameDirectories *dirs, CPackages *p)
26
		LoadText(CGameDirectories *dirs, bool reload) : _pVFS(NULL),
-
 
27
			_pDirs(dirs),
-
 
28
			_bReload(reload)
27
		{
29
		{
28
			InitializeComponent();
30
			InitializeComponent();
29
 
31
 
30
			_sCurrentDir = new Utils::String();
32
			_sCurrentDir = new Utils::String();
31
			m_pPackages = p;
-
 
32
			_pDirs = dirs;
-
 
33
		}
33
		}
34
 
34
 
-
 
35
		LoadText(CVirtualFileSystem *vfs) : _pVFS(vfs),
-
 
36
			_pDirs(NULL),
-
 
37
			_bReload(false)
-
 
38
		{
-
 
39
			InitializeComponent();
-
 
40
 
-
 
41
			_sCurrentDir = new Utils::String();
-
 
42
			*_sCurrentDir = vfs->directory();
-
 
43
		}
-
 
44
 
35
		void Start()
45
		void Start()
36
		{
46
		{
37
			this->label2->Text = _US(*_sCurrentDir);
47
			this->label2->Text = _US(*_sCurrentDir);
38
			this->backgroundWorker1->RunWorkerAsync();
48
			this->backgroundWorker1->RunWorkerAsync();
39
		}
49
		}
40
 
50
 
41
		void DoWork()
51
		void DoWork()
42
		{
52
		{
43
			if ( _sCurrentDir->empty() ) return;
53
			if ( _sCurrentDir->empty() ) return;
-
 
54
			if ( _pVFS ) _pVFS->updateTexts(0);
44
			_pDirs->updateCurrentVFS();
55
			else if ( _pDirs ) _pDirs->updateCurrentVFS(_bReload);
45
		}
56
		}
46
 
57
 
47
		void Next()
58
		void Next()
48
		{
59
		{
-
 
60
			if ( _pDirs ) {
49
			*_sCurrentDir = _pDirs->next();
61
				*_sCurrentDir = _pDirs->next();
50
			if ( !_sCurrentDir->empty() )
62
				if ( !_sCurrentDir->empty() ) {
51
				this->Start();
63
					this->Start();
-
 
64
					return;
52
			else
65
				}
-
 
66
			}
-
 
67
 
53
				this->Close();
68
			this->Close();
54
		}
69
		}
55
 
70
 
56
	protected:
71
	protected:
57
		/// <summary>
72
		/// <summary>
58
		/// Clean up any resources being used.
73
		/// Clean up any resources being used.
Line 68... Line 83...
68
	protected: 
83
	protected: 
69
	private: System::Windows::Forms::Label^  label2;
84
	private: System::Windows::Forms::Label^  label2;
70
	private: System::ComponentModel::BackgroundWorker^  backgroundWorker1;
85
	private: System::ComponentModel::BackgroundWorker^  backgroundWorker1;
71
 
86
 
72
	private:
87
	private:
-
 
88
		bool _bReload;
-
 
89
		CVirtualFileSystem *_pVFS;
73
		Collections::Hashtable	^m_pTextList;
90
		Collections::Hashtable	^m_pTextList;
74
		CPackages	*m_pPackages;
-
 
75
		Utils::String *_sCurrentDir;
91
		Utils::String *_sCurrentDir;
76
		CGameDirectories *_pDirs;
92
		CGameDirectories *_pDirs;
77
		/// <summary>
93
		/// <summary>
78
		/// Required designer variable.
94
		/// Required designer variable.
79
		/// </summary>
95
		/// </summary>
Line 96... Line 112...
96
			this->label1->Dock = System::Windows::Forms::DockStyle::Top;
112
			this->label1->Dock = System::Windows::Forms::DockStyle::Top;
97
			this->label1->Font = (gcnew System::Drawing::Font(L"Microsoft Sans Serif", 12, System::Drawing::FontStyle::Bold, System::Drawing::GraphicsUnit::Point, 
113
			this->label1->Font = (gcnew System::Drawing::Font(L"Microsoft Sans Serif", 12, System::Drawing::FontStyle::Bold, System::Drawing::GraphicsUnit::Point, 
98
				static_cast<System::Byte>(0)));
114
				static_cast<System::Byte>(0)));
99
			this->label1->Location = System::Drawing::Point(10, 10);
115
			this->label1->Location = System::Drawing::Point(10, 10);
100
			this->label1->Name = L"label1";
116
			this->label1->Name = L"label1";
101
			this->label1->Size = System::Drawing::Size(231, 32);
117
			this->label1->Size = System::Drawing::Size(459, 32);
102
			this->label1->TabIndex = 0;
118
			this->label1->TabIndex = 0;
103
			this->label1->Text = L"Loading Text";
119
			this->label1->Text = L"Loading Text";
104
			this->label1->TextAlign = System::Drawing::ContentAlignment::MiddleCenter;
120
			this->label1->TextAlign = System::Drawing::ContentAlignment::MiddleCenter;
105
			this->label1->UseWaitCursor = true;
121
			this->label1->UseWaitCursor = true;
106
			// 
122
			// 
Line 109... Line 125...
109
			this->label2->Dock = System::Windows::Forms::DockStyle::Fill;
125
			this->label2->Dock = System::Windows::Forms::DockStyle::Fill;
110
			this->label2->Font = (gcnew System::Drawing::Font(L"Microsoft Sans Serif", 8.25F, System::Drawing::FontStyle::Italic, System::Drawing::GraphicsUnit::Point, 
126
			this->label2->Font = (gcnew System::Drawing::Font(L"Microsoft Sans Serif", 8.25F, System::Drawing::FontStyle::Italic, System::Drawing::GraphicsUnit::Point, 
111
				static_cast<System::Byte>(0)));
127
				static_cast<System::Byte>(0)));
112
			this->label2->Location = System::Drawing::Point(10, 42);
128
			this->label2->Location = System::Drawing::Point(10, 42);
113
			this->label2->Name = L"label2";
129
			this->label2->Name = L"label2";
114
			this->label2->Size = System::Drawing::Size(231, 23);
130
			this->label2->Size = System::Drawing::Size(459, 23);
115
			this->label2->TabIndex = 1;
131
			this->label2->TabIndex = 1;
116
			this->label2->TextAlign = System::Drawing::ContentAlignment::TopCenter;
132
			this->label2->TextAlign = System::Drawing::ContentAlignment::TopCenter;
117
			this->label2->UseWaitCursor = true;
133
			this->label2->UseWaitCursor = true;
118
			// 
134
			// 
119
			// backgroundWorker1
135
			// backgroundWorker1
Line 124... Line 140...
124
			// LoadText
140
			// LoadText
125
			// 
141
			// 
126
			this->AutoScaleDimensions = System::Drawing::SizeF(6, 13);
142
			this->AutoScaleDimensions = System::Drawing::SizeF(6, 13);
127
			this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font;
143
			this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font;
128
			this->BackColor = System::Drawing::Color::Gray;
144
			this->BackColor = System::Drawing::Color::Gray;
129
			this->ClientSize = System::Drawing::Size(251, 75);
145
			this->ClientSize = System::Drawing::Size(479, 75);
130
			this->ControlBox = false;
146
			this->ControlBox = false;
131
			this->Controls->Add(this->label2);
147
			this->Controls->Add(this->label2);
132
			this->Controls->Add(this->label1);
148
			this->Controls->Add(this->label1);
133
			this->Cursor = System::Windows::Forms::Cursors::WaitCursor;
149
			this->Cursor = System::Windows::Forms::Cursors::WaitCursor;
134
			this->FormBorderStyle = System::Windows::Forms::FormBorderStyle::None;
150
			this->FormBorderStyle = System::Windows::Forms::FormBorderStyle::None;
Line 147... Line 163...
147
#pragma endregion
163
#pragma endregion
148
	private: System::Void backgroundWorker1_DoWork(System::Object^  sender, System::ComponentModel::DoWorkEventArgs^  e) {
164
	private: System::Void backgroundWorker1_DoWork(System::Object^  sender, System::ComponentModel::DoWorkEventArgs^  e) {
149
				 this->DoWork();
165
				 this->DoWork();
150
			 }
166
			 }
151
	private: System::Void LoadText_Load(System::Object^  sender, System::EventArgs^  e) {
167
	private: System::Void LoadText_Load(System::Object^  sender, System::EventArgs^  e) {
-
 
168
				 if ( _pDirs ) 
152
				 *_sCurrentDir = _pDirs->first();
169
					*_sCurrentDir = _pDirs->first();
153
				 this->Start();
170
				 this->Start();
154
			 }
171
			 }
155
	private: System::Void backgroundWorker1_RunWorkerCompleted(System::Object^  sender, System::ComponentModel::RunWorkerCompletedEventArgs^  e) {
172
	private: System::Void backgroundWorker1_RunWorkerCompleted(System::Object^  sender, System::ComponentModel::RunWorkerCompletedEventArgs^  e) {
156
				 this->Next();
173
				 this->Next();
157
			 }
174
			 }