Index: trunk/ab5.0/abdev/abdev/ProjectControl.cpp
===================================================================
--- trunk/ab5.0/abdev/abdev/ProjectControl.cpp	(revision 653)
+++ trunk/ab5.0/abdev/abdev/ProjectControl.cpp	(revision 655)
@@ -135,5 +135,5 @@
 								// 対象ファイルを開く
 								lstrcpy(temporary,
-									projectInfo.pobj_DBFileInfo->ppobj_FileInfo[pobj_ClassTreeView->pProcInfo[i].FileNum]->GetPath().c_str());
+									projectInfo.fileSystem.root.FindFile( pobj_ClassTreeView->pProcInfo[i].hFileTreeItem ).GetRelationalPath().c_str());
 								lstrcpy( temporary, projectInfo.GetWorkDir().GetFullPath( temporary ).c_str() );
 								hChild=OpenFileWithExtension(temporary);
@@ -652,5 +652,6 @@
 
 	//重複チェック
-	if(projectInfo.pobj_DBFileInfo->dupli_check(path)){
+	if( projectInfo.fileSystem.root.IsExistFile( path ) )
+	{
 		//"\"%s\" ファイルは既にプロジェクト内に存在します。"
 		sprintf(temporary,STRING_DUPLICATIONERROR_FILE_IN_PROJECT,path);
@@ -669,5 +670,5 @@
 
 	//projectInfo.ppobj_DBFileInfoオブジェクトに追加
-	projectInfo.pobj_DBFileInfo->add(path,hTreeItem);
+	projectInfo.fileSystem.root.files.push_back( ActiveBasic::PM::FM::File( path, hTreeItem ) );
 
 
@@ -675,25 +676,25 @@
 
 	//ファイル操作によるクラスビューの再表示
-	ResetClassTree(-1);
+	ResetClassTree((HTREEITEM)-1);
 }
 void Project_File_Delete(HTREEITEM hTreeItem){
 	extern HANDLE hHeap;
 
-	if(projectInfo.pobj_DBFileInfo->IsMainFile(hTreeItem)){
+	/*if(projectInfo.pobj_DBFileInfo->IsMainFile(hTreeItem)){
 		//"このファイルはプロジェクトのメイン ファイルです。プロジェクト内から削除することはできません。"
 		MessageBox(hOwner,STRING_ERROR_CANT_MAINFILE,STRING_ERROR,MB_OK|MB_ICONEXCLAMATION);
 		return;
-	}
+	}*/
 
 	//ツリービューから削除
 	pobj_FileTree->DeleteItem( hTreeItem );
 
-	//projectInfo.pobj_DBFileInfoオブジェクトから削除
-	projectInfo.pobj_DBFileInfo->del(hTreeItem);
+	// オブジェクトから削除
+	projectInfo.fileSystem.root.Remove( hTreeItem );
 
 	projectInfo.modify=1;
 
 	//ファイル操作によるクラスビューの再表示
-	ResetClassTree(-1);
+	ResetClassTree((HTREEITEM)-1);
 }
 
@@ -1127,8 +1128,8 @@
 
 	//ファイル ツリー
-	pobj_FileTree->Reset( projectInfo.pobj_DBFileInfo );
+	pobj_FileTree->Reset( projectInfo.fileSystem );
 
 	//関数ツリー
-	ResetClassTree(-1);
+	ResetClassTree((HTREEITEM)-1);
 
 	/////////////////////
@@ -1599,8 +1600,5 @@
 		if(IS_DOCUMENT_TEXT(MdiInfo[WndNum]->DocType)){
 			if( MdiInfo[WndNum]->pMdiTextEdit->IsModified() ){
-				for(i=0;i<projectInfo.pobj_DBFileInfo->iNum;i++){
-					projectInfo.pobj_DBFileInfo->ppobj_FileInfo[i]->GetFullPath(temporary);
-					if(lstrcmpi(MdiInfo[WndNum]->path.c_str(),temporary)==0) sw=1;
-				}
+				sw = projectInfo.fileSystem.root.IsExistFile( MdiInfo[WndNum]->path );
 			}
 		}
@@ -1638,9 +1636,45 @@
 	return 2;
 }
+
+void MakeTextMdiWindowBuffer( ActiveBasic::PM::FM::Folder &folder, int WndNum, char *buffer )
+{
+	BOOST_FOREACH( ActiveBasic::PM::FM::Folder &childFolder, folder.folders )
+	{
+		MakeTextMdiWindowBuffer( childFolder, WndNum, buffer );
+	}
+
+	BOOST_FOREACH( ActiveBasic::PM::FM::File &file, folder.files )
+	{
+		if(lstrcmpi(MdiInfo[WndNum]->path.c_str(),file.GetFullPath().c_str())==0){
+			CHARRANGE CharRange;
+			TextEdit_GetSel(WndNum,&CharRange);
+
+			SCROLLINFO si;
+			POINT pos;
+			si.cbSize=sizeof(SCROLLINFO);
+			si.fMask=SIF_POS;
+			GetScrollInfo(MdiInfo[WndNum]->pMdiTextEdit->hEdit,SB_HORZ,&si);
+			pos.x=si.nPos;
+			GetScrollInfo(MdiInfo[WndNum]->pMdiTextEdit->hEdit,SB_VERT,&si);
+			pos.y=si.nPos;
+
+			char temporary[1024];
+			sprintf(temporary,"text,\"%s\",%d,%d,%d,%d\r\n",
+				file.GetRelationalPath().c_str(),
+				pos.x,
+				pos.y,
+				CharRange.cpMin,
+				CharRange.cpMax);
+
+			lstrcat( buffer, temporary );
+			break;
+		}
+	}
+}
+
 void MakeWorkFile(void){
 	int i,i2,WndNum;
 	char temporary[MAX_PATH],buffer[32767];
 	HWND hChild;
-	CHARRANGE CharRange;
 
 	//ワークファイル（*.wrk）を作成
@@ -1655,28 +1689,6 @@
 		WndNum=GetWndNum(hChild);
 		if(IS_DOCUMENT_TEXT(MdiInfo[WndNum]->DocType)){
-			for(i=0;i<projectInfo.pobj_DBFileInfo->iNum;i++){
-				projectInfo.pobj_DBFileInfo->ppobj_FileInfo[i]->GetFullPath(temporary);
-				if(lstrcmpi(MdiInfo[WndNum]->path.c_str(),temporary)==0){
-					TextEdit_GetSel(WndNum,&CharRange);
-
-					SCROLLINFO si;
-					POINT pos;
-					si.cbSize=sizeof(SCROLLINFO);
-					si.fMask=SIF_POS;
-					GetScrollInfo(MdiInfo[WndNum]->pMdiTextEdit->hEdit,SB_HORZ,&si);
-					pos.x=si.nPos;
-					GetScrollInfo(MdiInfo[WndNum]->pMdiTextEdit->hEdit,SB_VERT,&si);
-					pos.y=si.nPos;
-
-					sprintf(buffer+i2,"text,\"%s\",%d,%d,%d,%d\r\n",
-						projectInfo.pobj_DBFileInfo->ppobj_FileInfo[i]->GetPath().c_str(),
-						pos.x,
-						pos.y,
-						CharRange.cpMin,
-						CharRange.cpMax);
-					i2+=lstrlen(buffer+i2);
-					break;
-				}
-			}
+			MakeTextMdiWindowBuffer( projectInfo.fileSystem.root, WndNum, buffer );
+			i2 = lstrlen( buffer );
 		}
 		else if(MdiInfo[WndNum]->DocType==WNDTYPE_RAD){
@@ -1763,5 +1775,6 @@
 	WIN32_FIND_DATA wfd;
 
-	if(projectInfo.pobj_DBFileInfo->iNum==0){
+	if( projectInfo.fileSystem.root.IsEmpty() )
+	{
 		//"プログラム ファイルがプロジェクトに存在しません。"
 		MessageBox(hOwner,STRING_ERROR_NOFILE,STRING_ERROR,MB_OK|MB_ICONEXCLAMATION);
@@ -1787,6 +1800,30 @@
 	return 1;
 }
+bool IsNeedCompileForProject( const ActiveBasic::PM::FM::Folder &folder, const FILETIME &exeTime )
+{
+	BOOST_FOREACH( const ActiveBasic::PM::FM::Folder &childFolder, folder.folders )
+	{
+		if( IsNeedCompileForProject( childFolder, exeTime ) )
+		{
+			return true;
+		}
+	}
+
+	BOOST_FOREACH( const ActiveBasic::PM::FM::File &file, folder.files )
+	{
+		HANDLE hFile=CreateFile(file.GetFullPath().c_str(),GENERIC_READ,FILE_SHARE_READ|FILE_SHARE_WRITE,NULL,OPEN_EXISTING,FILE_ATTRIBUTE_NORMAL,NULL);
+		FILETIME sourceTime;
+		GetFileTime(hFile,NULL,NULL,&sourceTime);
+		CloseHandle(hFile);
+
+		if(sourceTime.dwHighDateTime>exeTime.dwHighDateTime||
+			sourceTime.dwHighDateTime==exeTime.dwHighDateTime&&
+			sourceTime.dwLowDateTime>exeTime.dwLowDateTime) return true;
+	}
+
+	return false;
+}
+
 BOOL IsNeedCompileForProject(BOOL bDebug){
-	int i2;
 	char temporary[MAX_PATH];
 	HANDLE hFind,hFile;
@@ -1806,13 +1843,7 @@
 	CloseHandle(hFile);
 
-	for(i2=0;i2<projectInfo.pobj_DBFileInfo->iNum;i2++){
-		projectInfo.pobj_DBFileInfo->ppobj_FileInfo[i2]->GetFullPath(temporary);
-		hFile=CreateFile(temporary,GENERIC_READ,FILE_SHARE_READ|FILE_SHARE_WRITE,NULL,OPEN_EXISTING,FILE_ATTRIBUTE_NORMAL,NULL);
-		GetFileTime(hFile,NULL,NULL,&SourceTime);
-		CloseHandle(hFile);
-
-		if(SourceTime.dwHighDateTime>ExeTime.dwHighDateTime||
-			SourceTime.dwHighDateTime==ExeTime.dwHighDateTime&&
-			SourceTime.dwLowDateTime>ExeTime.dwLowDateTime) return 1;
+	if( IsNeedCompileForProject( projectInfo.fileSystem.root, ExeTime ) )
+	{
+		return 1;
 	}
 	if( !projectInfo.windowInfos.empty() )
