Index: trunk/ab5.0/abdev/abdev/src/ProjectManager/ProjectManager.cpp
===================================================================
--- trunk/ab5.0/abdev/abdev/src/ProjectManager/ProjectManager.cpp	(revision 651)
+++ trunk/ab5.0/abdev/abdev/src/ProjectManager/ProjectManager.cpp	(revision 655)
@@ -33,5 +33,5 @@
 
 	//解析
-	this->pobj_DBFileInfo=new CDBFileInfo();
+	this->fileSystem.root.Clear();
 	bool isUseWindow = false;
 	for(i=0;;i++){
@@ -200,5 +200,5 @@
 					}
 					if(temporary[0]=='\0') break;
-					this->pobj_DBFileInfo->add(temporary,0);
+					this->fileSystem.root.files.push_back( ActiveBasic::PM::FM::File( temporary, 0 ) );
 
 					if(buffer[i]=='\0') break;
@@ -265,7 +265,41 @@
 
 void SetStatusText(char *MenuText);
+void MakeSourceListToProjectFile( const ActiveBasic::PM::FM::Folder &folder, char *buffer )
+{
+	BOOST_FOREACH( const ActiveBasic::PM::FM::Folder &childFolder, folder.folders )
+	{
+		MakeSourceListToProjectFile( childFolder, buffer );
+	}
+
+	BOOST_FOREACH( const ActiveBasic::PM::FM::File &file, folder.files )
+	{
+		lstrcat( buffer, file.GetRelationalPath().c_str() );
+		lstrcat( buffer, "\r\n" );
+	}
+}
+void MakeIncludeListToProjectFile( const ActiveBasic::PM::FM::Folder &folder, char *buffer, bool isRoot )
+{
+	BOOST_FOREACH( const ActiveBasic::PM::FM::Folder &childFolder, folder.folders )
+	{
+		MakeIncludeListToProjectFile( childFolder, buffer, false );
+	}
+
+	bool isFirst = true;
+	BOOST_FOREACH( const ActiveBasic::PM::FM::File &file, folder.files )
+	{
+		if( isRoot && isFirst )
+		{
+			// メインファイルは除く
+			isFirst = false;
+			continue;
+		}
+
+		sprintf(buffer+lstrlen(buffer),"#include \"%s\"\r\n",file.GetRelationalPath().c_str());
+		lstrcpy(buffer+lstrlen(buffer),"_ClearNamespaceImported\r\n");
+	}
+}
 void Project::Save()
 {
-	int i,i2,i3,WndNum;
+	int i2,i3,WndNum;
 	char temporary[MAX_PATH],buffer[32767];
 	HWND hChild;
@@ -280,11 +314,9 @@
 		WndNum=GetWndNum(hChild);
 		if(IS_DOCUMENT_TEXT(MdiInfo[WndNum]->DocType)){
-			if( MdiInfo[WndNum]->pMdiTextEdit->IsModified() ){
-				for(i=0;i<this->pobj_DBFileInfo->iNum;i++){
-					this->pobj_DBFileInfo->ppobj_FileInfo[i]->GetFullPath(temporary);
-					if(lstrcmpi(MdiInfo[WndNum]->path.c_str(),temporary)==0){
-						SaveDocument(hChild,NULL);
-						break;
-					}
+			if( MdiInfo[WndNum]->pMdiTextEdit->IsModified() )
+			{
+				if( this->fileSystem.root.IsExistFile( MdiInfo[WndNum]->path ) )
+				{
+					SaveDocument(hChild,NULL);
 				}
 			}
@@ -342,8 +374,6 @@
 	sprintf(buffer+i2,"#SOURCE\r\n");
 	i2+=lstrlen(buffer+i2);
-	for(i=0;i<this->pobj_DBFileInfo->iNum;i++){
-		sprintf(buffer+i2,"%s\r\n",this->pobj_DBFileInfo->ppobj_FileInfo[i]->GetPath().c_str());
-		i2+=lstrlen(buffer+i2);
-	}
+	MakeSourceListToProjectFile( this->fileSystem.root, buffer );
+	i2 = lstrlen( buffer );
 
 	//保存
@@ -469,16 +499,12 @@
 		i2+=lstrlen(buffer+i2);
 	}
-	if(this->pobj_DBFileInfo->iNum>1){
+
+	{
 		lstrcpy(buffer+i2,"\r\n");
 		i2+=lstrlen(buffer+i2);
 		lstrcpy(buffer+i2,"'プロジェクト内のプログラム ファイル\r\n");
 		i2+=lstrlen(buffer+i2);
-		for(i=1;i<this->pobj_DBFileInfo->iNum;i++){
-			//メインファイルは含まない
-			sprintf(buffer+i2,"#include \"%s\"\r\n",this->pobj_DBFileInfo->ppobj_FileInfo[i]->GetPath().c_str());
-			i2+=lstrlen(buffer+i2);
-			lstrcpy(buffer+i2,"_ClearNamespaceImported\r\n");
-			i2+=lstrlen(buffer+i2);
-		}
+		MakeIncludeListToProjectFile( this->fileSystem.root, buffer, true );
+		i2 = lstrlen(buffer);
 	}
 	if( !this->windowInfos.empty() )
@@ -548,15 +574,12 @@
 		hChild=GetNextWindow(hChild,GW_HWNDNEXT);
 		WndNum=GetWndNum(hCloseChild);
-		if(IS_DOCUMENT_TEXT(MdiInfo[WndNum]->DocType)){
-			for(i=0;i<this->pobj_DBFileInfo->iNum;i++){
-				this->pobj_DBFileInfo->ppobj_FileInfo[i]->GetFullPath(temporary);
-				if(lstrcmpi(MdiInfo[WndNum]->path.c_str(),temporary)==0){
-
-					//変更フラグをオフにする
-					MdiInfo[WndNum]->pMdiTextEdit->UnModify();
-
-					SendMessage(hCloseChild,WM_CLOSE,0,0);
-					break;
-				}
+		if(IS_DOCUMENT_TEXT(MdiInfo[WndNum]->DocType))
+		{
+			if( this->fileSystem.root.IsExistFile( MdiInfo[WndNum]->path ) )
+			{
+				//変更フラグをオフにする
+				MdiInfo[WndNum]->pMdiTextEdit->UnModify();
+
+				SendMessage(hCloseChild,WM_CLOSE,0,0);
 			}
 		}
@@ -593,5 +616,5 @@
 
 	//ファイル情報のメモリを解放
-	delete this->pobj_DBFileInfo;
+	this->fileSystem.root.Clear();
 
 	//ブレークポイントのオブジェクトを解放
