Subversion Repositories spk

Rev

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

Rev 178 Rev 180
Line 664... Line 664...
664
		}
664
		}
665
		else if ( E->Data->GetDataPresent(DataFormats::FileDrop) )
665
		else if ( E->Data->GetDataPresent(DataFormats::FileDrop) )
666
			E->Effect = DragDropEffects::Copy;
666
			E->Effect = DragDropEffects::Copy;
667
	}
667
	}
668
 
668
 
669
	void SpkForm::DropGetDirectories(String ^dir, CyStringList *list, bool packages)
669
	void SpkForm::DropGetDirectories(String ^dir, Utils::CStringList *list, bool packages)
670
	{
670
	{
671
		cli::array<String ^> ^dirList = IO::Directory::GetFileSystemEntries(dir);
671
		cli::array<String ^> ^dirList = IO::Directory::GetFileSystemEntries(dir);
672
		for ( int j = 0; j < dirList->Length; j++ )
672
		for ( int j = 0; j < dirList->Length; j++ )
673
		{
673
		{
674
			if ( IO::DirectoryInfo(dirList[j]).Exists )
674
			if ( IO::DirectoryInfo(dirList[j]).Exists )
675
				this->DropGetDirectories(dirList[j], list, packages);
675
				this->DropGetDirectories(dirList[j], list, packages);
676
			else
676
			else
677
			{
677
			{
678
				if ( packages )
678
				if ( packages )
679
					list->PushBack(CyStringFromSystemString(dirList[j]), "-1");
679
					list->pushBack(_S(dirList[j]), "-1");
680
				else
680
				else
681
					list->PushBack(CyStringFromSystemString(dirList[j]), CyString::Number(SPK::GetAutomaticFiletype(_S(dirList[j]), NULL, false)));
681
					list->pushBack(_S(dirList[j]), Utils::String::Number(SPK::GetAutomaticFiletype(_S(dirList[j]), NULL, false)));
682
			}
682
			}
683
		}
683
		}
684
	}
684
	}
685
 
685
 
686
	System::Void SpkForm::listView2_DragDrop(System::Object^  sender, System::Windows::Forms::DragEventArgs^  E)
686
	System::Void SpkForm::listView2_DragDrop(System::Object^  sender, System::Windows::Forms::DragEventArgs^  E)
Line 688... Line 688...
688
		if ( !m_pMultiPackage )
688
		if ( !m_pMultiPackage )
689
			return;
689
			return;
690
 
690
 
691
		if ( E->Data->GetDataPresent(DataFormats::FileDrop) )
691
		if ( E->Data->GetDataPresent(DataFormats::FileDrop) )
692
		{
692
		{
693
			CyStringList fileList;
693
			Utils::CStringList fileList;
694
			cli::array<String ^> ^a = (cli::array<String ^> ^)E->Data->GetData(DataFormats::FileDrop, false);
694
			cli::array<String ^> ^a = (cli::array<String ^> ^)E->Data->GetData(DataFormats::FileDrop, false);
695
			int i;
695
			int i;
696
			for(i = 0; i < a->Length; i++)
696
			for(i = 0; i < a->Length; i++)
697
			{
697
			{
698
				if ( IO::DirectoryInfo(a[i]).Exists )
698
				if ( IO::DirectoryInfo(a[i]).Exists )
699
					this->DropGetDirectories(a[i], &fileList, true);
699
					this->DropGetDirectories(a[i], &fileList, true);
700
				else
700
				else
701
					fileList.PushBack(CyStringFromSystemString(a[i]), "-1");
701
					fileList.pushBack(_S(a[i]), "-1");
702
			}
702
			}
703
 
703
 
704
			// remove invalid files
704
			// remove invalid files
705
			if ( !fileList.Empty() )
705
			if ( !fileList.empty() )
706
			{
706
			{
707
				AddDialog ^ad = gcnew AddDialog(NULL, m_pMultiPackage);
707
				AddDialog ^ad = gcnew AddDialog(NULL, m_pMultiPackage);
708
				for ( SStringList *str = fileList.Head(); str; str = str->;next )
708
				for(auto itr = fileList.begin(); itr != fileList.end(); itr++)
709
				{
709
				{
710
					if ( str-&gt;data != ";-1" )
710
					if ((*itr)-&gt;data != ";-1")
711
						continue;
711
						continue;
712
 
712
 
713
					Utils::String ext = CFileIO(str->str).extension();
713
					Utils::String ext = CFileIO((*itr)->str).extension();
714
					if ( !ext.Compare("xsp") && !ext.Compare("spk") )
714
					if ( !ext.Compare("xsp") && !ext.Compare("spk") )
715
						continue;
715
						continue;
716
					
716
					
717
					ad->AddFile(SystemStringFromCyString(str->str), "", -1, 0);
717
					ad->AddFile(_US((*itr)->str), "", -1, 0);
718
				}
718
				}
719
 
719
 
720
				ad->ShowDialog(this);
720
				ad->ShowDialog(this);
721
				this->UpdateView(false);
721
				this->UpdateView(false);
722
			}
722
			}
Line 726... Line 726...
726
	System::Void SpkForm::listView1_DragDrop(System::Object^  sender, System::Windows::Forms::DragEventArgs^ E)
726
	System::Void SpkForm::listView1_DragDrop(System::Object^  sender, System::Windows::Forms::DragEventArgs^ E)
727
	{
727
	{
728
		// dropping from outside
728
		// dropping from outside
729
		if ( E->Data->GetDataPresent(DataFormats::FileDrop) )
729
		if ( E->Data->GetDataPresent(DataFormats::FileDrop) )
730
		{
730
		{
731
			CyStringList fileList;
731
			Utils::CStringList fileList;
732
			cli::array<String ^> ^a = (cli::array<String ^> ^)E->Data->GetData(DataFormats::FileDrop, false);
732
			cli::array<String ^> ^a = (cli::array<String ^> ^)E->Data->GetData(DataFormats::FileDrop, false);
733
			int i;
733
			int i;
734
			for(i = 0; i < a->Length; i++)
734
			for(i = 0; i < a->Length; i++)
735
			{
735
			{
736
				if ( IO::DirectoryInfo(a[i]).Exists )
736
				if ( IO::DirectoryInfo(a[i]).Exists )
737
					this->DropGetDirectories(a[i], &fileList, false);
737
					this->DropGetDirectories(a[i], &fileList, false);
738
				else
738
				else
739
					fileList.PushBack(CyStringFromSystemString(a[i]), CyString::Number(SPK::GetAutomaticFiletype(_S(a[i]), NULL, false)));
739
					fileList.pushBack(_S(a[i]), Utils::String::Number(SPK::GetAutomaticFiletype(_S(a[i]), NULL, false)));
740
			}
740
			}
741
 
741
 
742
			SPK::AssignAutomaticFiletypes(&fileList);
742
			SPK::AssignAutomaticFiletypes(fileList);
743
 
743
 
744
			if ( !fileList.Empty() )
744
			if ( !fileList.empty() )
745
			{
745
			{
746
				DropFileDialog ^dropType = gcnew DropFileDialog(&fileList);
746
				DropFileDialog ^dropType = gcnew DropFileDialog(&fileList);
747
				if ( dropType->ShowDialog(this) == Forms::DialogResult::OK )
747
				if ( dropType->ShowDialog(this) == Forms::DialogResult::OK )
748
				{
748
				{
749
					AddDialog ^ad = gcnew AddDialog(m_pPackage, NULL);
749
					AddDialog ^ad = gcnew AddDialog(m_pPackage, NULL);
750
					for ( SStringList *str = fileList.Head(); str; str = str->;next )
750
					for(auto itr = fileList.begin(); itr != fileList.end(); itr++)
751
					{
751
					{
752
						int type = str-&gt;data.GetToken(" ", 1, 1).ToInt();
752
						int type = (*itr)-&gt;data.token(" ", 1).toInt();
753
						if ( type == -1 )
753
						if ( type == -1 )
754
							continue;
754
							continue;
755
						ad->AddFile(SystemStringFromCyString(str->str), "", type, 0);
755
						ad->AddFile(_US((*itr)->str), "", type, 0);
756
					}
756
					}
757
					if ( ad->AnyFiles() )
757
					if ( ad->AnyFiles() )
758
					{
758
					{
759
						ad->ShowDialog(this);
759
						ad->ShowDialog(this);
760
						this->UpdateView(false);
760
						this->UpdateView(false);