Subversion Repositories spk

Rev

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

Rev 226 Rev 237
Line 3... Line 3...
3
#include "InputBox.h"
3
#include "InputBox.h"
4
#include "Form1.h"
4
#include "Form1.h"
5
#include "AddWareText.h"
5
#include "AddWareText.h"
6
#include "AddCockpit.h"
6
#include "AddCockpit.h"
7
#include "SaveDialog.h"
7
#include "SaveDialog.h"
-
 
8
#include "AddGlobal.h"
8
 
9
 
9
#include <Package/InstallText.h>
10
#include <Package/InstallText.h>
10
 
11
 
11
namespace Creator {
12
namespace Creator {
12
	void PackageForm::_init() 
13
	void PackageForm::_init() 
Line 15... Line 16...
15
		this->TextExactVersion->Visible = false;
16
		this->TextExactVersion->Visible = false;
16
		this->DoToolTips();
17
		this->DoToolTips();
17
 
18
 
18
		this->ListDep->LargeImageList = this->imageList1;
19
		this->ListDep->LargeImageList = this->imageList1;
19
		this->ListDep->SmallImageList = this->imageList1;
20
		this->ListDep->SmallImageList = this->imageList1;
-
 
21
		this->listGlobals->LargeImageList = this->imageList1;
-
 
22
		this->listGlobals->SmallImageList = this->imageList1;
20
 
23
 
21
		m_iFormType = FORMTYPE_SINGLE;
24
		m_iFormType = FORMTYPE_SINGLE;
22
		m_pDisplayFile = NULL;
25
		m_pDisplayFile = NULL;
23
 
26
 
24
		this->NumTextID->Visible = false;
27
		this->NumTextID->Visible = false;
Line 475... Line 478...
475
		this->UpdateDisplayPic();
478
		this->UpdateDisplayPic();
476
		this->UpdateDisplayIcon();
479
		this->UpdateDisplayIcon();
477
		this->UpdateRatings();
480
		this->UpdateRatings();
478
		this->UpdateText();
481
		this->UpdateText();
479
		this->UpdateDependacies();
482
		this->UpdateDependacies();
-
 
483
		this->UpdateGlobals();
480
 
484
 
481
		// delete the pages
485
		// delete the pages
482
		if ( m_pPackage->GetType() != TYPE_XSP )
486
		if ( m_pPackage->GetType() != TYPE_XSP )
483
		{
487
		{
484
			delete this->PageShip;
488
			delete this->PageShip;
Line 511... Line 515...
511
			item->SubItems->Add(_US(nl->sMinVersion));
515
			item->SubItems->Add(_US(nl->sMinVersion));
512
			item->ImageIndex = 3;
516
			item->ImageIndex = 3;
513
			this->ListDep->Items->Add(item);
517
			this->ListDep->Items->Add(item);
514
		}
518
		}
515
		this->ListDep->AutoResizeColumns(ColumnHeaderAutoResizeStyle::HeaderSize);
519
		this->ListDep->AutoResizeColumns(ColumnHeaderAutoResizeStyle::HeaderSize);
-
 
520
	}
-
 
521
 
-
 
522
	void PackageForm::UpdateGlobals()
-
 
523
	{
-
 
524
		this->listGlobals->Items->Clear();
-
 
525
		auto& list = m_pPackage->getGlobals();
-
 
526
		for (auto itr = list.begin(); itr != list.end(); itr++)
-
 
527
		{
-
 
528
			ListViewItem^ item = gcnew ListViewItem(_US((*itr)->str));
-
 
529
			item->SubItems->Add(_US((*itr)->data));
-
 
530
			item->ImageIndex = 3;
-
 
531
			this->listGlobals->Items->Add(item);
-
 
532
		}
516
	}
533
	}
517
 
534
 
518
	void PackageForm::UpdateShipPartList()
535
	void PackageForm::UpdateShipPartList()
519
	{
536
	{
520
		if ( !m_pPackage )
537
		if ( !m_pPackage )
Line 1032... Line 1049...
1032
		{
1049
		{
1033
			if (file->game() & (1 << 31))
1050
			if (file->game() & (1 << 31))
1034
			{			
1051
			{			
1035
				Utils::WString sGames = L"";
1052
				Utils::WString sGames = L"";
1036
				for (int i = 0; i < 31; ++i)
1053
				for (int i = 0; i < 31; ++i)
1037
				{
1054
				{
1038
					int gameMask = 1 << i;
1055
					int gameMask = 1 << i;
1039
					if (file->game() & gameMask)
1056
					if (file->game() & gameMask)
1040
					{
1057
					{
1041
						Utils::WString sGame;
1058
						Utils::WString sGame;
1042
						SGameExe *exe = _pPackages->GetGameExe()->game(i - 1);
1059
						SGameExe *exe = _pPackages->GetGameExe()->game(i - 1);
Line 1378... Line 1395...
1378
			this->UpdateFileList();
1395
			this->UpdateFileList();
1379
		}
1396
		}
1380
	}
1397
	}
1381
 
1398
 
1382
	void PackageForm::AddDisplayIcon()
1399
	void PackageForm::AddDisplayIcon()
1383
	{
1400
	{
1384
		OpenFileDialog ^ofd = gcnew OpenFileDialog();
1401
		OpenFileDialog ^ofd = gcnew OpenFileDialog();
1385
		ofd->Filter = "Icon Files|*.ico;*.png;*.bmp";
1402
		ofd->Filter = "Icon Files|*.ico;*.png;*.bmp";
1386
		ofd->FilterIndex = 1;
1403
		ofd->FilterIndex = 1;
1387
		ofd->RestoreDirectory = true;
1404
		ofd->RestoreDirectory = true;
1388
		ofd->Multiselect = false;
1405
		ofd->Multiselect = false;
1389
		ofd->Title = "Select the Icon file to add";
1406
		ofd->Title = "Select the Icon file to add";
Line 1722... Line 1739...
1722
		CFileIO F(_WS(file));
1739
		CFileIO F(_WS(file));
1723
		if ( !F.exists() )
1740
		if ( !F.exists() )
1724
			return;
1741
			return;
1725
 
1742
 
1726
		std::vector<Utils::WString> lines;
1743
		std::vector<Utils::WString> lines;
1727
		if(!F.readLines(lines))
1744
		if(!F.readLines(lines))
1728
			return;
1745
			return;
1729
 
1746
 
1730
		LoadShip ^load = gcnew LoadShip();
1747
		LoadShip ^load = gcnew LoadShip();
1731
 
1748
 
1732
		int entryPos = 1;
1749
		int entryPos = 1;
1733
		int dataPos = 1;
1750
		int dataPos = 1;
1734
		int dataPos2 = 0;
1751
		int dataPos2 = 0;
1735
		bool sections = false;
1752
		bool sections = false;
Line 1747... Line 1764...
1747
				break;
1764
				break;
1748
			case 4:
1765
			case 4:
1749
				sections = true;
1766
				sections = true;
1750
				entryPos = 2;
1767
				entryPos = 2;
1751
				load->Bodies();
1768
				load->Bodies();
1752
				break;
1769
				break;
1753
			case 1:
1770
			case 1:
1754
				sections = true;
1771
				sections = true;
1755
				entryPos = 2;
1772
				entryPos = 2;
1756
				dataPos = -1;
1773
				dataPos = -1;
1757
				load->Dummies();
1774
				load->Dummies();
Line 1811... Line 1828...
1811
					if ( entries2 )
1828
					if ( entries2 )
1812
					{
1829
					{
1813
						load->AddShip(_US(data), _US(str));
1830
						load->AddShip(_US(data), _US(str));
1814
						list.pushBack(data, section + L";" + data + L";" + str);
1831
						list.pushBack(data, section + L";" + data + L";" + str);
1815
						--entries2;
1832
						--entries2;
1816
					}
1833
					}
1817
					else
1834
					else
1818
					{
1835
					{
1819
						data = str.token(L";", 1);
1836
						data = str.token(L";", 1);
1820
						entries2 = str.token(L";", 2).toInt();
1837
						entries2 = str.token(L";", 2).toInt();
1821
						++e;
1838
						++e;
1822
						--entries;
1839
						--entries;
Line 1899... Line 1916...
1899
			{
1916
			{
1900
				((CXspFile *)m_pPackage)->addAnimation(*load->GetDataList());
1917
				((CXspFile *)m_pPackage)->addAnimation(*load->GetDataList());
1901
				this->UpdateShipPartList();
1918
				this->UpdateShipPartList();
1902
				this->UpdateChanged();
1919
				this->UpdateChanged();
1903
			}
1920
			}
-
 
1921
		}
-
 
1922
	}
-
 
1923
 
-
 
1924
	void PackageForm::EditGlobal()
-
 
1925
	{
-
 
1926
		AddGlobal^ global = gcnew AddGlobal();
-
 
1927
		global->SetEdit(m_pSelectedItem->Text, m_pSelectedItem->SubItems[1]->Text);
-
 
1928
 
-
 
1929
		if (global->ShowDialog(this) == Windows::Forms::DialogResult::OK)
-
 
1930
		{
-
 
1931
			m_pPackage->removeGlobal(_WS(global->GetName()));
-
 
1932
			m_pPackage->addGlobal(_WS(global->GetName()), _WS(global->GetData()));
-
 
1933
 
-
 
1934
			this->UpdateGlobals();
-
 
1935
			this->UpdateChanged();
-
 
1936
		}
-
 
1937
 
-
 
1938
		this->UpdateDependacies();
-
 
1939
		this->UpdateChanged();
-
 
1940
	}
-
 
1941
 
-
 
1942
	void PackageForm::AddNewGlobal()
-
 
1943
	{
-
 
1944
		AddGlobal^ global = gcnew AddGlobal();
-
 
1945
		if (global->ShowDialog(this) == Windows::Forms::DialogResult::OK)
-
 
1946
		{
-
 
1947
			m_pPackage->addGlobal(_WS(global->GetName()), _WS(global->GetData()));
-
 
1948
			this->UpdateGlobals();
-
 
1949
			this->UpdateChanged();
1904
		}
1950
		}
1905
	}
1951
	}
1906
 
1952
 
1907
	void PackageForm::EditDepend()
1953
	void PackageForm::EditDepend()
1908
	{
1954
	{