Index: trunk/ab5.0/abdev/abdev/CFileInfo.cpp
===================================================================
--- trunk/ab5.0/abdev/abdev/CFileInfo.cpp	(revision 653)
+++ 	(revision )
@@ -1,75 +1,0 @@
-#include "stdafx.h"
-
-#include "common.h"
-
-CFileInfo::CFileInfo( const std::string &filepath, HTREEITEM hTreeItem )
-	: filepath( filepath )
-	, m_hTreeItem( hTreeItem )
-{
-}
-void CFileInfo::GetFullPath(char *buffer){
-	lstrcpy(buffer,this->GetPath().c_str());
-	lstrcpy( buffer, projectInfo.GetWorkDir().GetFullPath( buffer ).c_str() );
-}
-
-
-CDBFileInfo::CDBFileInfo(){
-	iNum=0;
-	ppobj_FileInfo=(CFileInfo **)HeapAlloc(hHeap,0,1);
-}
-CDBFileInfo::~CDBFileInfo(){
-	int i;
-	for(i=0;i<iNum;i++){
-		delete ppobj_FileInfo[i];
-	}
-	HeapDefaultFree(ppobj_FileInfo);
-}
-
-void CDBFileInfo::add(char *path,HTREEITEM hTreeItem){
-	ppobj_FileInfo=(CFileInfo **)HeapReAlloc(hHeap,0,ppobj_FileInfo,(iNum+1)*sizeof(CFileInfo *));
-	ppobj_FileInfo[iNum]=new CFileInfo(path,hTreeItem);
-	iNum++;
-}
-void CDBFileInfo::del(HTREEITEM hTreeItem){
-	int i;
-	for(i=0;i<iNum;i++){
-		if(ppobj_FileInfo[i]->m_hTreeItem==hTreeItem) break;
-	}
-	if(i==iNum) return;
-
-	delete ppobj_FileInfo[i];
-
-	iNum--;
-	for(;i<iNum;i++) ppobj_FileInfo[i]=ppobj_FileInfo[i+1];
-}
-const std::string &CDBFileInfo::GetPath(HTREEITEM hTreeItem)
-{
-	for( int i=0; i<iNum; i++ )
-	{
-		if(ppobj_FileInfo[i]->m_hTreeItem==hTreeItem)
-		{
-			return ppobj_FileInfo[i]->GetPath();
-		}
-	}
-
-	_ASSERTE( false );
-	throw;
-}
-BOOL CDBFileInfo::IsMainFile(HTREEITEM hTreeItem){
-	int i;
-	for(i=0;i<iNum;i++){
-		if(ppobj_FileInfo[i]->m_hTreeItem==hTreeItem) break;
-	}
-	if(i==0) return 1;
-	return 0;
-}
-BOOL CDBFileInfo::dupli_check(char *path){
-	//重複チェック
-	int i;
-	for(i=0;i<iNum;i++){
-		if(lstrcmpi(ppobj_FileInfo[i]->GetPath().c_str(),path)==0){
-			return 1;
-		}
-	}
-	return 0;
-}
Index: trunk/ab5.0/abdev/abdev/Caret.cpp
===================================================================
--- trunk/ab5.0/abdev/abdev/Caret.cpp	(revision 653)
+++ trunk/ab5.0/abdev/abdev/Caret.cpp	(revision 655)
@@ -155,8 +155,7 @@
 }
 
-void GetScrollBaseCaretPos(int WndNum,int *pNaturalBaseX,int *pNaturalBaseY){
-
-	HWND hEdit;
-	hEdit=MdiInfo[WndNum]->pMdiTextEdit->hEdit;
+void GetScrollBaseCaretPos(MDIINFO *pMdiInfo,int *pNaturalBaseX,int *pNaturalBaseY)
+{
+	HWND hEdit = pMdiInfo->pMdiTextEdit->hEdit;
 
 	//垂直スクロールバーの位置
@@ -236,5 +235,5 @@
 	x=MdiInfo[WndNum]->pMdiTextEdit->StartCaretPos.x;
 	y=MdiInfo[WndNum]->pMdiTextEdit->StartCaretPos.y;
-	GetScrollBaseCaretPos(WndNum,&x,&y);
+	GetScrollBaseCaretPos(MdiInfo[WndNum],&x,&y);
 
 	//エディタ画面左端のコントロールタブ
@@ -466,5 +465,5 @@
 	x=MdiInfo[WndNum]->pMdiTextEdit->StartCaretPos.x;
 	y=MdiInfo[WndNum]->pMdiTextEdit->StartCaretPos.y;
-	GetScrollBaseCaretPos(WndNum,&x,&y);
+	GetScrollBaseCaretPos(MdiInfo[WndNum],&x,&y);
 
 	//垂直方向
Index: trunk/ab5.0/abdev/abdev/ClassTree.cpp
===================================================================
--- trunk/ab5.0/abdev/abdev/ClassTree.cpp	(revision 653)
+++ trunk/ab5.0/abdev/abdev/ClassTree.cpp	(revision 655)
@@ -20,5 +20,5 @@
 	return lpdata%MAX_HASH;
 }
-void CClassTreeView::AddValidItem(HTREEITEM hItem,int iFileNum){
+void CClassTreeView::AddValidItem(HTREEITEM hItem,HTREEITEM hFileTreeItem){
 	//ハッシュ値を取得
 	int key;
@@ -42,5 +42,5 @@
 
 	pth->hItem=hItem;
-	pth->iFileNum=iFileNum;
+	pth->hFileTreeItem = hFileTreeItem;
 	pth->pNextData=0;
 }
@@ -85,5 +85,5 @@
 
 void CClassTreeView::DeleteTreeHash(TREEHASH *pth){
-	if(pth->hItem && (iNowFile==-1 || iNowFile==pth->iFileNum)){
+	if(pth->hItem && (hNowFileTreeItem==(HTREEITEM)-1 || hNowFileTreeItem==pth->hFileTreeItem)){
 		if(pth->pNextData){
 			DeleteTreeHash(pth->pNextData);
@@ -96,5 +96,5 @@
 
 
-HTREEITEM CClassTreeView::insert(HTREEITEM hParentItem,int flag,char *lpszName,int iFileNum){
+HTREEITEM CClassTreeView::insert(HTREEITEM hParentItem,int flag,char *lpszName,HTREEITEM hFileTreeItem){
 	char temporary[255];
 
@@ -110,5 +110,5 @@
 		if(lstrcmp(lpszName,tvItem.pszText)==0){
 			//既に挿入済みの場合
-			AddValidItem(hNextItem,iFileNum);
+			AddValidItem(hNextItem,hFileTreeItem);
 			return hNextItem;
 		}
@@ -158,5 +158,5 @@
 
 	hNextItem=TreeView_InsertItem(hTreeWnd,&tv);
-	AddValidItem(hNextItem,iFileNum);
+	AddValidItem(hNextItem,hFileTreeItem);
 	return hNextItem;
 }
@@ -170,5 +170,5 @@
 	while(bSearchingClasses) Sleep(10);
 
-	iNowFile=-1;
+	this->hNowFileTreeItem = (HTREEITEM)-1;
 
 	int i;
@@ -186,8 +186,8 @@
 	}
 }
-void CClassTreeView::init(HWND hwnd,int iFileNum){
+void CClassTreeView::init(HWND hwnd,HTREEITEM hFileTreeItem){
 	hTreeWnd=hwnd;
 
-	iNowFile=iFileNum;
+	this->hNowFileTreeItem = hFileTreeItem;
 
 	int i;
@@ -203,5 +203,5 @@
 		TVI_ROOT,
 		CTV_ROOT,
-		temporary,-1);
+		temporary,(HTREEITEM)-1);
 }
 void CClassTreeView::InsertGlobalProcedureFolder(void){
@@ -209,16 +209,16 @@
 		hRootFolder,
 		CTV_FOLDER,
-		"グローバル関数",-1);
-}
-
-HTREEITEM CClassTreeView::InsertGlobalProcedure(int flag,char *lpszName,int iFileNum){
+		"グローバル関数",(HTREEITEM)-1);
+}
+
+HTREEITEM CClassTreeView::InsertGlobalProcedure(int flag,char *lpszName,HTREEITEM hFileTreeItem){
 	return pobj_ClassTreeView->insert(
 		hGlobalProcedureFolder,
 		CTV_GLOBAL_PROC,
 		lpszName,
-		iFileNum);
-}
-
-HTREEITEM CClassTreeView::insert_code_item(HTREEITEM hParentItem,int flag,char *lpszName,int iFileNum,char *pBuf,int p){
+		hFileTreeItem);
+}
+
+HTREEITEM CClassTreeView::insert_code_item(HTREEITEM hParentItem,int flag,char *lpszName,HTREEITEM hFileTreeItem,char *pBuf,int p){
 	int i4;
 	i4=NumberOfProcedures;
@@ -226,5 +226,5 @@
 	pProcInfo[i4].name=(char *)HeapAlloc(hHeap,0,lstrlen(lpszName)+1);
 	lstrcpy(pProcInfo[i4].name,lpszName);
-	pProcInfo[i4].FileNum=iFileNum;
+	pProcInfo[i4].hFileTreeItem = hFileTreeItem;
 
 	//コード位置
@@ -237,5 +237,5 @@
 		flag,
 		lpszName,
-		iFileNum);
+		hFileTreeItem);
 
 	pProcInfo[i4].hTreeItem=hTempItem;
@@ -246,9 +246,9 @@
 }
 
-void CClassTreeView::InsertClassFolder(char *lpszName,int iFileNum,char *pBuf,int p){
-	hNowClassFolder=insert_code_item(hRootFolder,CTV_CLASS,lpszName,iFileNum,pBuf,p);
-}
-void CClassTreeView::InsertClassMember(int flag,char *lpszName,int iFileNum,char *pBuf,int p){
-	insert_code_item(hNowClassFolder,flag,lpszName,iFileNum,pBuf,p);
+void CClassTreeView::InsertClassFolder(char *lpszName,HTREEITEM hFileTreeItem,char *pBuf,int p){
+	hNowClassFolder=insert_code_item(hRootFolder,CTV_CLASS,lpszName,hFileTreeItem,pBuf,p);
+}
+void CClassTreeView::InsertClassMember(int flag,char *lpszName,HTREEITEM hFileTreeItem,char *pBuf,int p){
+	insert_code_item(hNowClassFolder,flag,lpszName,hFileTreeItem,pBuf,p);
 }
 
@@ -258,5 +258,5 @@
 
 
-void AnalysisClass(char *pBuf,int *p,int iFileNum){
+void AnalysisClass(char *pBuf,int *p,HTREEITEM hFileTreeItem){
 	int i2;
 	i2=*p;
@@ -272,5 +272,5 @@
 	pobj_ClassTreeView->InsertClassFolder(
 		pobj_ClassInfo->ClassName,
-		iFileNum,
+		hFileTreeItem,
 		pBuf,
 		i2);
@@ -307,5 +307,5 @@
 			}
 		}
-		pobj_ClassTreeView->InsertClassMember(flag,pobj_ClassInfo->pMemberInfo[i].pName,iFileNum,pBuf,pobj_ClassInfo->pMemberInfo[i].code_pos);
+		pobj_ClassTreeView->InsertClassMember(flag,pobj_ClassInfo->pMemberInfo[i].pName,hFileTreeItem,pBuf,pobj_ClassInfo->pMemberInfo[i].code_pos);
 	}
 
@@ -316,5 +316,5 @@
 
 
-void SetClassTreeFromOneFile_Buf( char *pBuf, int iFileNum ){
+void SetClassTreeFromOneFile_Buf( char *pBuf, HTREEITEM hFileTreeItem ){
 	int i2,i3,i4;
 	char temporary[GENERAL_SIZE];
@@ -345,5 +345,5 @@
 				// クラスの解析
 				/////////////////////////////
-				AnalysisClass(pBuf,&i4,iFileNum);
+				AnalysisClass(pBuf,&i4,hFileTreeItem);
 
 				i2=i4-1;
@@ -384,5 +384,5 @@
 				pobj_ClassTreeView->pProcInfo[i4].name=(char *)HeapAlloc(hHeap,0,lstrlen(temporary)+1);
 				lstrcpy(pobj_ClassTreeView->pProcInfo[i4].name,temporary);
-				pobj_ClassTreeView->pProcInfo[i4].FileNum=iFileNum;
+				pobj_ClassTreeView->pProcInfo[i4].hFileTreeItem = hFileTreeItem;
 
 				//定義行の選択範囲
@@ -433,5 +433,5 @@
 					CTV_GLOBAL_PROC,
 					pobj_ClassTreeView->pProcInfo[i4].name,
-					iFileNum);
+					hFileTreeItem);
 				pobj_ClassTreeView->pProcInfo[i4].hTreeItem=hTempItem;
 
@@ -443,5 +443,5 @@
 	}
 }
-void SetClassTreeFromOneFile(char *lpszFilePath,int iFileNum){
+void SetClassTreeFromOneFile( const ActiveBasic::PM::FM::File &file){
 	int WndNum;
 	HWND hChild=GetWindow(hClient,GW_CHILD);
@@ -451,5 +451,5 @@
 		{
 			if(IS_DOCUMENT_TEXT(MdiInfo[WndNum]->DocType)){
-				if(lstrcmpi(MdiInfo[WndNum]->path.c_str(),lpszFilePath)==0) break;
+				if(lstrcmpi(MdiInfo[WndNum]->path.c_str(),file.GetFullPath().c_str())==0) break;
 			}
 			hChild=GetNextWindow(hChild,GW_HWNDNEXT);
@@ -464,22 +464,32 @@
 	else{
 		//開かれていない場合
-		pBuf=ReadBuffer(lpszFilePath);
+		pBuf=ReadBuffer(file.GetFullPath());
 		if(!pBuf) pBuf=(char *)HeapAlloc(hHeap,HEAP_ZERO_MEMORY,1);
 	}
 
-	SetClassTreeFromOneFile_Buf( pBuf, iFileNum );
+	SetClassTreeFromOneFile_Buf( pBuf, file.GetTreeItemHandle() );
 
 	if(!hChild) HeapDefaultFree(pBuf);
 }
-
-void SetProcedureTreeData(void *temp_iFileNum){
-	int i;
-	char temporary[MAX_PATH];
+void SetClassTreeFromAllFile( ActiveBasic::PM::FM::Folder &folder )
+{
+	BOOST_FOREACH( ActiveBasic::PM::FM::Folder &childFolder, folder.folders )
+	{
+		SetClassTreeFromAllFile( childFolder );
+	}
+
+	BOOST_FOREACH( ActiveBasic::PM::FM::File &file, folder.files )
+	{
+		SetClassTreeFromOneFile( file );
+	}
+}
+
+void SetProcedureTreeData(void *temp_hFileTreeItem)
+{
 	BOOL bExpand;
 	TVITEM tvItem;
 	SCROLLINFO si;
 
-	int iFileNum;
-	iFileNum=(int)temp_iFileNum;
+	HTREEITEM hFileTreeItem = (HTREEITEM)temp_hFileTreeItem;
 
 	if(bSearchingClasses){
@@ -504,6 +514,6 @@
 
 		//プロシージャ情報のメモリを解放
-		for(i=0;i<pobj_ClassTreeView->NumberOfProcedures;i++){
-			if(iFileNum==-1 || iFileNum==pobj_ClassTreeView->pProcInfo[i].FileNum){
+		for(int i=0;i<pobj_ClassTreeView->NumberOfProcedures;i++){
+			if(hFileTreeItem==(HTREEITEM)-1 || hFileTreeItem==pobj_ClassTreeView->pProcInfo[i].hFileTreeItem){
 				HeapDefaultFree(pobj_ClassTreeView->pProcInfo[i].name);
 			}
@@ -539,5 +549,5 @@
 
 
-	pobj_ClassTreeView->init(hProcedureTreeView,iFileNum);
+	pobj_ClassTreeView->init(hProcedureTreeView,hFileTreeItem);
 
 	//ルートフォルダ
@@ -553,11 +563,9 @@
 	if( projectInfo.IsOpened() ){
 		// プロジェクトが開かれているとき
-		if(iFileNum==-1){
+		if(hFileTreeItem==(HTREEITEM)-1){
+			boost::mutex::scoped_lock lock( projectInfo.fileSystem.mutex );
+
 			//プロジェクトのすべてのファイルを解析
-			for(i=0;i<projectInfo.pobj_DBFileInfo->iNum;i++){
-				projectInfo.pobj_DBFileInfo->ppobj_FileInfo[i]->GetFullPath(temporary);
-
-				SetClassTreeFromOneFile(temporary,i);
-			}
+			SetClassTreeFromAllFile( projectInfo.fileSystem.root );
 
 			//不要になったアイテムを除去
@@ -569,7 +577,5 @@
 			/////////////////////////////////
 
-			projectInfo.pobj_DBFileInfo->ppobj_FileInfo[iFileNum]->GetFullPath(temporary);
-
-			SetClassTreeFromOneFile(temporary,iFileNum);
+			SetClassTreeFromOneFile( projectInfo.fileSystem.root.FindFile( hFileTreeItem ) );
 		}
 	}
@@ -580,5 +586,5 @@
 		int WndNum=GetWndNum(hChild);
 		char *pBuf=MdiInfo[WndNum]->pMdiTextEdit->buffer;
-		SetClassTreeFromOneFile_Buf( pBuf, -1 );
+		SetClassTreeFromOneFile_Buf( pBuf, (HTREEITEM)-1 );
 
 	}
@@ -601,5 +607,5 @@
 	if(bRetrySearchingClasses){
 		bRetrySearchingClasses=0;
-		ResetClassTree(iFileNum);
+		ResetClassTree(hFileTreeItem);
 	}
 
@@ -617,5 +623,5 @@
 	_endthread();
 }
-void ResetClassTree(int iFileNum){
-	_beginthread(SetProcedureTreeData,0,(void *)iFileNum);
-}
+void ResetClassTree(HTREEITEM hFileTreeItem){
+	_beginthread(SetProcedureTreeData,0,(void *)hFileTreeItem);
+}
Index: trunk/ab5.0/abdev/abdev/Common.h
===================================================================
--- trunk/ab5.0/abdev/abdev/Common.h	(revision 653)
+++ trunk/ab5.0/abdev/abdev/Common.h	(revision 655)
@@ -406,37 +406,9 @@
 #define PROJECT_VERSION	10
 
-class CFileInfo{
-	std::string filepath;
-public:
-	HTREEITEM m_hTreeItem;
-	CFileInfo( const std::string &filepath, HTREEITEM hTreeItem );
-
-	const std::string &GetPath() const
-	{
-		return filepath;
-	}
-
-	void GetFullPath(char *buffer);
-};
-class CDBFileInfo{
-public:
-	int iNum;
-	CFileInfo **ppobj_FileInfo;
-
-	CDBFileInfo();
-	~CDBFileInfo();
-
-	void add(char *path,HTREEITEM hTreeItem);
-	void del(HTREEITEM hTreeItem);
-	const std::string &GetPath(HTREEITEM hTreeItem);
-	BOOL IsMainFile(HTREEITEM hTreeItem);
-
-	BOOL dupli_check(char *path);
-};
-
 struct PROCINFO{
 	char *name;
-	int FileNum;
 	HTREEITEM hTreeItem;
+
+	HTREEITEM hFileTreeItem;
 
 	int code_pos;
@@ -597,5 +569,4 @@
 int GetWndNum(HWND hChild);
 int GetNowWndNum(void);
-int GetFileNum(int WndNum);
 void SendTextEditResizeEvent(HWND hwnd);
 void RedrawAllWindow(void);
@@ -761,5 +732,5 @@
 void TextEdit_GetSel(int WndNum,CHARRANGE *pCharRange);
 void TextEdit_GetSelText(int WndNum,CHARRANGE *pCharRange,char *buffer);
-void GetScrollBaseCaretPos(int WndNum,int *pNaturalBaseX,int *pNaturalBaseY);
+void GetScrollBaseCaretPos(MDIINFO *pMdiInfo,int *pNaturalBaseX,int *pNaturalBaseY);
 void GetNaturalBaseCaretPos(int WndNum,int *pScrollBaseX,int *pScrollBaseY);
 void TextEdit_SetSel(int WndNum,int StartIndex,int EndIndex,BOOL bShowCenter=0);
@@ -883,5 +854,5 @@
 struct TREEHASH{
 	HTREEITEM hItem;
-	int iFileNum;
+	HTREEITEM hFileTreeItem;
 	TREEHASH *pNextData;
 };
@@ -896,5 +867,5 @@
 class CClassTreeView{
 	HWND hTreeWnd;
-	int iNowFile;
+	HTREEITEM hNowFileTreeItem;
 	TREEHASH tree_data[MAX_HASH];
 
@@ -904,10 +875,10 @@
 	int hash_default(LONG_PTR lpdata);
 
-	void AddValidItem(HTREEITEM hItem,int iFileNum);
+	void AddValidItem(HTREEITEM hItem,HTREEITEM hFileTreeItem);
 	BOOL delete_check(HTREEITEM hItem);
 	void DeleteInvalidItems(HTREEITEM hItem);
 	void DeleteTreeHash(TREEHASH *pth);
 
-	HTREEITEM insert(HTREEITEM hParentItem,int flag,char *lpszName,int iFileNum);
+	HTREEITEM insert(HTREEITEM hParentItem,int flag,char *lpszName,HTREEITEM hFileTreeItem);
 
 public:
@@ -922,16 +893,16 @@
 	CClassTreeView();
 	~CClassTreeView();
-	void init(HWND hwnd,int iFileNum);
+	void init(HWND hwnd,HTREEITEM hFileTreeItem);
 
 	void InsertRootFolder(void);
 	void InsertGlobalProcedureFolder(void);
-	HTREEITEM InsertGlobalProcedure(int flag,char *lpszName,int iFileNum);
-	HTREEITEM insert_code_item(HTREEITEM hParentItem,int flag,char *lpszName,int iFileNum,char *pBuf,int p);
-	void InsertClassFolder(char *lpszName,int iFileNum,char *pBuf,int p);
-	void InsertClassMember(int flag,char *lpszName,int iFileNum,char *pBuf,int p);
+	HTREEITEM InsertGlobalProcedure(int flag,char *lpszName,HTREEITEM hFileTreeItem);
+	HTREEITEM insert_code_item(HTREEITEM hParentItem,int flag,char *lpszName,HTREEITEM hFileTreeItem,char *pBuf,int p);
+	void InsertClassFolder(char *lpszName,HTREEITEM hFileTreeItem,char *pBuf,int p);
+	void InsertClassMember(int flag,char *lpszName,HTREEITEM hFileTreeItem,char *pBuf,int p);
 	void finish();
 };
 extern CClassTreeView *pobj_ClassTreeView;
-void ResetClassTree(int iFileNum);
+void ResetClassTree(HTREEITEM hFileTreeItem);
 
 //ProjectControl.cpp
Index: trunk/ab5.0/abdev/abdev/Complement.cpp
===================================================================
--- trunk/ab5.0/abdev/abdev/Complement.cpp	(revision 653)
+++ trunk/ab5.0/abdev/abdev/Complement.cpp	(revision 655)
@@ -391,5 +391,5 @@
 	POINT pos;
 	pos=MdiInfo[WndNum]->pMdiTextEdit->StartCaretPos;
-	GetScrollBaseCaretPos(WndNum,(int *)&pos.x,(int *)&pos.y);
+	GetScrollBaseCaretPos(MdiInfo[WndNum],(int *)&pos.x,(int *)&pos.y);
 
 	pos.x=(pos.x-1)*font_width    +iControlTabSpace;
Index: trunk/ab5.0/abdev/abdev/DrawBuffer.cpp
===================================================================
--- trunk/ab5.0/abdev/abdev/DrawBuffer.cpp	(revision 653)
+++ trunk/ab5.0/abdev/abdev/DrawBuffer.cpp	(revision 655)
@@ -311,5 +311,5 @@
 	BaseX=0;
 	BaseY=0;
-	GetScrollBaseCaretPos(WndNum,&BaseX,&BaseY);
+	GetScrollBaseCaretPos(MdiInfo[WndNum],&BaseX,&BaseY);
 
 	if(pobj_nv->bEditor_CaretLine_BackGround){
Index: trunk/ab5.0/abdev/abdev/FileTree.cpp
===================================================================
--- trunk/ab5.0/abdev/abdev/FileTree.cpp	(revision 653)
+++ trunk/ab5.0/abdev/abdev/FileTree.cpp	(revision 655)
@@ -22,5 +22,5 @@
 				hTreeItem = pobj_FileTree->GetSelectedItem();
 
-				std::string tempPath = projectInfo.pobj_DBFileInfo->GetPath(hTreeItem);
+				std::string tempPath = projectInfo.fileSystem.root.FindFile( hTreeItem ).GetRelationalPath();
 
 				//絶対パス、相対パスを表示
@@ -107,5 +107,5 @@
 						hTreeItem=TreeView_GetSelection(hwnd);
 
-						std::string tempPath = projectInfo.pobj_DBFileInfo->GetPath(hTreeItem);
+						std::string tempPath = projectInfo.fileSystem.root.FindFile( hTreeItem ).GetRelationalPath();
 
 						lstrcpy( temporary, tempPath.c_str() );
@@ -194,28 +194,43 @@
 }
 
-void FileListTreeViewCtrl::Reset( CDBFileInfo *pFileInfos )
-{
+void FileListTreeViewCtrl::Reset( HTREEITEM hParent, ActiveBasic::PM::FM::Folder &folder )
+{
+	char temporary[MAX_PATH],temp2[MAX_PATH];
+
+	lstrcpy( temporary, folder.GetName().c_str() );
+
 	TV_INSERTSTRUCT tv;
-
-	this->DeleteAllItems();
-
 	tv.hInsertAfter=TVI_SORT;
 	tv.item.mask=TVIF_TEXT|TVIF_IMAGE|TVIF_SELECTEDIMAGE;
-
-	tv.hParent=TVI_ROOT;
+	tv.hParent = hParent;
 	tv.item.iImage=0;
 	tv.item.iSelectedImage=0;
-	tv.item.pszText="Source Files";
-	tv.hParent = this->InsertItem( &tv );
-
-	int i;
-	char temporary[MAX_PATH],temp2[MAX_PATH];
-	for(i=0;i<pFileInfos->iNum;i++){
-		_splitpath(pFileInfos->ppobj_FileInfo[i]->GetPath().c_str(),0,0,temporary,temp2);
+	tv.item.pszText = temporary;
+	HTREEITEM hFolder = this->InsertItem( &tv );
+
+	BOOST_FOREACH( ActiveBasic::PM::FM::Folder &childFolder, folder.folders )
+	{
+		this->Reset( hFolder, childFolder );
+	}
+
+	BOOST_FOREACH( ActiveBasic::PM::FM::File &file, folder.files )
+	{
+		_splitpath(file.GetRelationalPath().c_str(),0,0,temporary,temp2);
 		lstrcat(temporary,temp2);
+
+		TV_INSERTSTRUCT tv;
+		tv.hInsertAfter=TVI_SORT;
+		tv.item.mask=TVIF_TEXT|TVIF_IMAGE|TVIF_SELECTEDIMAGE;
+		tv.hParent = hFolder;
 		tv.item.iImage=2;
 		tv.item.iSelectedImage=2;
 		tv.item.pszText=temporary;
-		pFileInfos->ppobj_FileInfo[i]->m_hTreeItem = this->InsertItem( &tv );
-	}
-}
+		file.SetTreeViewHandle( this->InsertItem( &tv ) );
+	}
+}
+void FileListTreeViewCtrl::Reset( ActiveBasic::PM::FM::FileSystem &fileSystem )
+{
+	this->DeleteAllItems();
+
+	this->Reset( TVI_ROOT, fileSystem.root );
+}
Index: trunk/ab5.0/abdev/abdev/FileTree.h
===================================================================
--- trunk/ab5.0/abdev/abdev/FileTree.h	(revision 653)
+++ trunk/ab5.0/abdev/abdev/FileTree.h	(revision 655)
@@ -1,4 +1,2 @@
-
-class CDBFileInfo;
 
 class FileListTreeViewCtrl
@@ -13,5 +11,8 @@
 
 	HTREEITEM Insert( const std::string &str );
-	void Reset( CDBFileInfo *pFileInfos );
+private:
+	void Reset( HTREEITEM hParent, ActiveBasic::PM::FM::Folder &folder );
+public:
+	void Reset( ActiveBasic::PM::FM::FileSystem &fileSystem );
 };
 
Index: trunk/ab5.0/abdev/abdev/ParameterHint.cpp
===================================================================
--- trunk/ab5.0/abdev/abdev/ParameterHint.cpp	(revision 653)
+++ trunk/ab5.0/abdev/abdev/ParameterHint.cpp	(revision 655)
@@ -35,6 +35,5 @@
 	if( projectInfo.IsOpened() ){
 		//プロジェクトが開かれているとき
-		lstrcpy(temporary,projectInfo.pobj_DBFileInfo->ppobj_FileInfo[0]->GetPath().c_str());
-		lstrcpy( temporary, projectInfo.GetWorkDir().GetFullPath( temporary ).c_str() );
+		lstrcpy(temporary,projectInfo.fileSystem.root.files[0].GetFullPath().c_str());
 
 		for(i=0;i<MdiInfo.size();i++){
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() )
Index: trunk/ab5.0/abdev/abdev/Replace.cpp
===================================================================
--- trunk/ab5.0/abdev/abdev/Replace.cpp	(revision 653)
+++ trunk/ab5.0/abdev/abdev/Replace.cpp	(revision 655)
@@ -182,5 +182,8 @@
 		if(MdiInfo[WndNum]->DocType==WNDTYPE_BASIC){
 			//クラスツリーを再表示
-			ResetClassTree(GetFileNum(WndNum));
+			HTREEITEM hFileTreeItem = projectInfo.fileSystem.root.IsExistFile( MdiInfo[WndNum]->path )
+				? projectInfo.fileSystem.root.FindFile( MdiInfo[WndNum]->path ).GetTreeItemHandle()
+				: (HTREEITEM)-1;
+			ResetClassTree( hFileTreeItem );
 		}
 	//}
Index: trunk/ab5.0/abdev/abdev/Ruler.cpp
===================================================================
--- trunk/ab5.0/abdev/abdev/Ruler.cpp	(revision 653)
+++ trunk/ab5.0/abdev/abdev/Ruler.cpp	(revision 655)
@@ -21,7 +21,7 @@
 }
 
-CRuler::CRuler(HWND hParent,int WndNum){
-	m_WndNum=WndNum;
-
+CRuler::CRuler(HWND hParent,MDIINFO *pMdiInfo)
+	: pMdiInfo( pMdiInfo )
+{
 	hRulerWnd=CreateWindowEx(0,"Ruler","Ruler",
 		WS_CHILD|WS_CLIPCHILDREN|WS_VISIBLE,
@@ -56,8 +56,8 @@
 	BaseX=0;
 	BaseY=0;
-	GetScrollBaseCaretPos(m_WndNum,&BaseX,&BaseY);
+	GetScrollBaseCaretPos(this->pMdiInfo,&BaseX,&BaseY);
 
 	int iControlTabSpace;
-	iControlTabSpace=MdiInfo[m_WndNum]->pMdiTextEdit->iWidth_ControlTabSpace;
+	iControlTabSpace=this->pMdiInfo->pMdiTextEdit->iWidth_ControlTabSpace;
 
 	HBRUSH hBrush,hOldBrush;
Index: trunk/ab5.0/abdev/abdev/Ruler.h
===================================================================
--- trunk/ab5.0/abdev/abdev/Ruler.h	(revision 653)
+++ trunk/ab5.0/abdev/abdev/Ruler.h	(revision 655)
@@ -4,11 +4,14 @@
 LRESULT CALLBACK RulerProc(HWND hwnd,UINT message,WPARAM wParam,LPARAM lParam);
 
-class CRuler{
-	int m_WndNum;
+class MDIINFO;
+
+class CRuler
+{
+	MDIINFO *pMdiInfo;
 	HDC memdc;
 	HBITMAP hMemBmp;
 public:
 	HWND hRulerWnd;
-	CRuler(HWND hParent,int WndNum);
+	CRuler(HWND hParent,MDIINFO *pMdiInfo);
 	~CRuler();
 
Index: trunk/ab5.0/abdev/abdev/SubOperation.cpp
===================================================================
--- trunk/ab5.0/abdev/abdev/SubOperation.cpp	(revision 653)
+++ trunk/ab5.0/abdev/abdev/SubOperation.cpp	(revision 655)
@@ -1371,16 +1371,4 @@
 	HeapDestroy(hHeap);
 
-	//DLLを解放
-	FreeLibrary(hResInst);
-	FreeLibrary(hIconResInst);
-	FreeLibrary(hLib_LuxCtrl);
-
-	//アルファブレンド用のAPIを解放
-	extern HINSTANCE hUser32Lib;
-	FreeLibrary(hUser32Lib);
-
-
-
-
 	//////////////////////////////////////
 	// バックアップ用ファイルを削除
@@ -1389,4 +1377,12 @@
 	RemoveDirectoryStrong(szBackupDirPath);
 
+	//DLLを解放
+	FreeLibrary(hResInst);
+	FreeLibrary(hIconResInst);
+	FreeLibrary(hLib_LuxCtrl);
+
+	//アルファブレンド用のAPIを解放
+	extern HINSTANCE hUser32Lib;
+	FreeLibrary(hUser32Lib);
 }
 
Index: trunk/ab5.0/abdev/abdev/TextEditor_ImeEvent.cpp
===================================================================
--- trunk/ab5.0/abdev/abdev/TextEditor_ImeEvent.cpp	(revision 653)
+++ trunk/ab5.0/abdev/abdev/TextEditor_ImeEvent.cpp	(revision 655)
@@ -21,5 +21,5 @@
 	CompForm.dwStyle=CFS_POINT;
 	pos=MdiInfo[WndNum]->pMdiTextEdit->StartCaretPos;
-	GetScrollBaseCaretPos(WndNum,(int *)&pos.x,(int *)&pos.y);
+	GetScrollBaseCaretPos(MdiInfo[WndNum],(int *)&pos.x,(int *)&pos.y);
 	CompForm.ptCurrentPos.x=pos.x*font_width+iControlTabSpace;
 	CompForm.ptCurrentPos.y=pos.y*font_height;
@@ -63,5 +63,5 @@
 		CompForm.dwStyle=CFS_POINT;
 		pos=MdiInfo[WndNum]->pMdiTextEdit->StartCaretPos;
-		GetScrollBaseCaretPos(WndNum,(int *)&pos.x,(int *)&pos.y);
+		GetScrollBaseCaretPos(MdiInfo[WndNum],(int *)&pos.x,(int *)&pos.y);
 		CompForm.ptCurrentPos.x=pos.x*font_width+iControlTabSpace;
 		CompForm.ptCurrentPos.y=pos.y*font_height;
Index: trunk/ab5.0/abdev/abdev/WindowControl.cpp
===================================================================
--- trunk/ab5.0/abdev/abdev/WindowControl.cpp	(revision 653)
+++ trunk/ab5.0/abdev/abdev/WindowControl.cpp	(revision 655)
@@ -2176,5 +2176,5 @@
 	//重複チェック
 	sprintf(temporary,"%s.sbp",NewWindow.name);
-	if(projectInfo.pobj_DBFileInfo->dupli_check(temporary)){
+	if(projectInfo.fileSystem.root.IsExistFile(temporary)){
 		sprintf(temp2,"\"%s\" ファイルは既にプロジェクト内に存在します。",temporary);
 		MessageBox(hOwner,temp2,APPLICATION_NAME,MB_OK|MB_ICONEXCLAMATION);
Index: trunk/ab5.0/abdev/abdev/abdev.cpp
===================================================================
--- trunk/ab5.0/abdev/abdev/abdev.cpp	(revision 653)
+++ trunk/ab5.0/abdev/abdev/abdev.cpp	(revision 655)
@@ -113,11 +113,7 @@
 	}
 
-	int i;
-	char temporary[MAX_PATH];
-	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) return i;
+	for(int i=0;i<projectInfo.fileSystem.root.files.size();i++)
+	{
+		if(lstrcmpi(MdiInfo[WndNum]->path.c_str(),projectInfo.fileSystem.root.files[i].GetFullPath().c_str())==0) return i;
 	}
 	return -1;
@@ -916,5 +912,5 @@
 	MdiInfo[i]->pMdiTextEdit->hEdit=hEdit;
 	MdiInfo[i]->pMdiTextEdit->pobj_WebResult=new CWebResult(hChild);
-	MdiInfo[i]->pMdiTextEdit->pobj_Ruler=new CRuler(hChild,i);
+	MdiInfo[i]->pMdiTextEdit->pobj_Ruler=new CRuler(hChild,MdiInfo[i]);
 	MdiInfo[i]->pMdiTextEdit->hIcon=shfi.hIcon;
 	MdiInfo[i]->pMdiTextEdit->buffer=buffer;
@@ -970,5 +966,5 @@
 
 			// クラスビューを更新
-			ResetClassTree(-1);
+			ResetClassTree((HTREEITEM)-1);
 		}
 	}
@@ -1163,5 +1159,5 @@
 
 			if( !projectInfo.IsOpened() ){
-				ResetClassTree(-1);
+				ResetClassTree((HTREEITEM)-1);
 			}
 
Index: trunk/ab5.0/abdev/abdev/abdev.vcproj
===================================================================
--- trunk/ab5.0/abdev/abdev/abdev.vcproj	(revision 653)
+++ trunk/ab5.0/abdev/abdev/abdev.vcproj	(revision 655)
@@ -82,4 +82,5 @@
 				LinkIncremental="1"
 				SuppressStartupBanner="true"
+				AdditionalLibraryDirectories="..\..\jenga\lib\x86;..\lib\x86"
 				ProgramDatabaseFile="$(IntDir)\$(ProjectName).pdb"
 				SubSystem="2"
@@ -180,4 +181,5 @@
 				LinkIncremental="2"
 				SuppressStartupBanner="true"
+				AdditionalLibraryDirectories="..\..\jenga\lib\x86;..\lib\x86"
 				GenerateDebugInformation="true"
 				ProgramDatabaseFile="$(IntDir)\$(ProjectName).pdb"
@@ -279,4 +281,5 @@
 				LinkIncremental="1"
 				SuppressStartupBanner="true"
+				AdditionalLibraryDirectories="..\..\jenga\lib\x86;..\lib\x86"
 				ProgramDatabaseFile="$(IntDir)\$(ProjectName).pdb"
 				SubSystem="2"
@@ -377,4 +380,5 @@
 				LinkIncremental="2"
 				SuppressStartupBanner="true"
+				AdditionalLibraryDirectories="..\..\jenga\lib\x86;..\lib\x86"
 				GenerateDebugInformation="true"
 				ProgramDatabaseFile="$(IntDir)\$(ProjectName).pdb"
@@ -2208,40 +2212,4 @@
 						>
 						<File
-							RelativePath="CFileInfo.cpp"
-							>
-							<FileConfiguration
-								Name="TheText_Release|Win32"
-								>
-								<Tool
-									Name="VCCLCompilerTool"
-									PreprocessorDefinitions=""
-								/>
-							</FileConfiguration>
-							<FileConfiguration
-								Name="Debug|Win32"
-								>
-								<Tool
-									Name="VCCLCompilerTool"
-									PreprocessorDefinitions=""
-								/>
-							</FileConfiguration>
-							<FileConfiguration
-								Name="Release|Win32"
-								>
-								<Tool
-									Name="VCCLCompilerTool"
-									PreprocessorDefinitions=""
-								/>
-							</FileConfiguration>
-							<FileConfiguration
-								Name="TheText_Debug|Win32"
-								>
-								<Tool
-									Name="VCCLCompilerTool"
-									PreprocessorDefinitions=""
-								/>
-							</FileConfiguration>
-						</File>
-						<File
 							RelativePath="FileTree.cpp"
 							>
@@ -2689,4 +2657,8 @@
 				Name="ProjectManager"
 				>
+				<File
+					RelativePath=".\src\ProjectManager\FileManager.cpp"
+					>
+				</File>
 				<File
 					RelativePath=".\src\ProjectManager\ProjectManager.cpp"
Index: trunk/ab5.0/abdev/abdev/include/ProjectManager/FileManager.h
===================================================================
--- trunk/ab5.0/abdev/abdev/include/ProjectManager/FileManager.h	(revision 653)
+++ trunk/ab5.0/abdev/abdev/include/ProjectManager/FileManager.h	(revision 655)
@@ -6,4 +6,20 @@
 class ItemBase
 {
+	HTREEITEM hTreeItem;
+
+public:
+	ItemBase( HTREEITEM hTreeItem )
+		: hTreeItem( hTreeItem )
+	{
+	}
+
+	HTREEITEM GetTreeItemHandle() const
+	{
+		return hTreeItem;
+	}
+	void SetTreeViewHandle( HTREEITEM hTreeItem )
+	{
+		this->hTreeItem = hTreeItem;
+	}
 };
 
@@ -12,4 +28,13 @@
 {
 	std::string relationalPath;
+
+public:
+	File( const std::string &relationalPath, HTREEITEM hTreeItem );
+
+	const std::string &GetRelationalPath() const
+	{
+		return relationalPath;
+	}
+	const std::string GetFullPath() const;
 };
 typedef std::vector<File> Files;
@@ -21,12 +46,39 @@
 	: public ItemBase
 {
+	std::string name;
+public:
 	Files files;
 	Folders folders;
+
+	Folder( const std::string &name, HTREEITEM hTreeItem )
+		: ItemBase( hTreeItem )
+		, name( name )
+	{
+	}
+
+	const std::string &GetName() const
+	{
+		return name;
+	}
+
+	bool IsEmpty() const;
+	void Clear();
+	File &FindFile( HTREEITEM hTreeItem );
+	File &FindFile( const std::string &path );
+	bool IsExistFile( HTREEITEM hTreeItem ) const;
+	bool IsExistFile( const std::string &path ) const;
+	void Remove( HTREEITEM hTreeItem );
 };
 
 class FileSystem
 {
-	Files files;
-	//Folders folders;
+public:
+	Folder root;
+	boost::mutex mutex;
+
+	FileSystem( const std::string &rootFolderName )
+		: root( rootFolderName, NULL )
+	{
+	}
 };
 
Index: trunk/ab5.0/abdev/abdev/include/ProjectManager/ProjectManager.h
===================================================================
--- trunk/ab5.0/abdev/abdev/include/ProjectManager/ProjectManager.h	(revision 653)
+++ trunk/ab5.0/abdev/abdev/include/ProjectManager/ProjectManager.h	(revision 655)
@@ -10,4 +10,5 @@
 	Project()
 		: workDir( "" )
+		, fileSystem( "Source Files" )
 	{
 	}
@@ -44,5 +45,5 @@
 	DWORD dwVersion;
 
-	CDBFileInfo *pobj_DBFileInfo;
+	FM::FileSystem fileSystem;
 
 	int NumberOfMenu;
Index: trunk/ab5.0/abdev/abdev/src/MainFrame.cpp
===================================================================
--- trunk/ab5.0/abdev/abdev/src/MainFrame.cpp	(revision 653)
+++ trunk/ab5.0/abdev/abdev/src/MainFrame.cpp	(revision 655)
@@ -1136,5 +1136,5 @@
 
 		//ソースファイル名をtemp2へ
-		projectInfo.pobj_DBFileInfo->ppobj_FileInfo[0]->GetFullPath(temp2);
+		lstrcpy( temp2, projectInfo.fileSystem.root.files[0].GetFullPath().c_str() );
 
 		//出力ファイル名をtemp3へ
@@ -1214,5 +1214,5 @@
 
 		//ソースファイル名をtemp2へ
-		projectInfo.pobj_DBFileInfo->ppobj_FileInfo[0]->GetFullPath(temp2);
+		lstrcpy( temp2, projectInfo.fileSystem.root.files[0].GetFullPath().c_str() );
 
 		//出力ファイル名をtemp3へ
@@ -1334,5 +1334,5 @@
 
 		//ソースファイル名をtemp2へ
-		projectInfo.pobj_DBFileInfo->ppobj_FileInfo[0]->GetFullPath(temp2);
+		lstrcpy( temp2, projectInfo.fileSystem.root.files[0].GetFullPath().c_str() );
 
 		//出力ファイル名をtemp3へ
Index: trunk/ab5.0/abdev/abdev/src/ProjectManager/FileManager.cpp
===================================================================
--- trunk/ab5.0/abdev/abdev/src/ProjectManager/FileManager.cpp	(revision 655)
+++ trunk/ab5.0/abdev/abdev/src/ProjectManager/FileManager.cpp	(revision 655)
@@ -0,0 +1,135 @@
+#include "stdafx.h"
+
+using namespace ActiveBasic::PM::FM;
+
+File::File( const std::string &relationalPath, HTREEITEM hTreeItem )
+	: ItemBase( hTreeItem )
+	, relationalPath( relationalPath )
+{
+}
+
+const std::string File::GetFullPath() const
+{
+	return projectInfo.GetWorkDir().GetFullPath( relationalPath );
+}
+
+bool ActiveBasic::PM::FM::Folder::IsEmpty() const
+{
+	BOOST_FOREACH( const ActiveBasic::PM::FM::Folder &folder, folders )
+	{
+		if( !folder.IsEmpty() )
+		{
+			return false;
+		}
+	}
+
+	return files.empty();
+}
+
+void ActiveBasic::PM::FM::Folder::Clear()
+{
+	files.clear();
+	folders.clear();
+}
+
+File &ActiveBasic::PM::FM::Folder::FindFile( HTREEITEM hTreeItem )
+{
+	BOOST_FOREACH( ActiveBasic::PM::FM::Folder &folder, folders )
+	{
+		if( folder.IsExistFile( hTreeItem ) )
+		{
+			return folder.FindFile( hTreeItem );
+		}
+	}
+
+	BOOST_FOREACH( File &file, files )
+	{
+		if( file.GetTreeItemHandle() == hTreeItem )
+		{
+			return file;
+		}
+	}
+	throw;
+}
+
+File &ActiveBasic::PM::FM::Folder::FindFile( const std::string &path )
+{
+	BOOST_FOREACH( ActiveBasic::PM::FM::Folder &folder, folders )
+	{
+		if( folder.IsExistFile( path ) )
+		{
+			return folder.FindFile( path );
+		}
+	}
+
+	BOOST_FOREACH( File &file, files )
+	{
+		if( file.GetRelationalPath() == path || file.GetFullPath() == path )
+		{
+			return file;
+		}
+	}
+	throw;
+}
+
+bool ActiveBasic::PM::FM::Folder::IsExistFile( const std::string &path ) const
+{
+	BOOST_FOREACH( const ActiveBasic::PM::FM::Folder &folder, folders )
+	{
+		if( folder.IsExistFile( path ) )
+		{
+			return true;
+		}
+	}
+
+	BOOST_FOREACH( const File &file, files )
+	{
+		if( file.GetRelationalPath() == path || file.GetFullPath() == path )
+		{
+			return true;
+		}
+	}
+	return false;
+}
+
+bool ActiveBasic::PM::FM::Folder::IsExistFile( HTREEITEM hTreeItem ) const
+{
+	BOOST_FOREACH( const ActiveBasic::PM::FM::Folder &folder, folders )
+	{
+		if( folder.IsExistFile( hTreeItem ) )
+		{
+			return true;
+		}
+	}
+
+	BOOST_FOREACH( const File &file, files )
+	{
+		if( file.GetTreeItemHandle() == hTreeItem )
+		{
+			return true;
+		}
+	}
+	return false;
+}
+
+void ActiveBasic::PM::FM::Folder::Remove( HTREEITEM hTreeItem )
+{
+	BOOST_FOREACH( ActiveBasic::PM::FM::Folder &folder, folders )
+	{
+		if( folder.IsExistFile( hTreeItem ) )
+		{
+			folder.Remove( hTreeItem );
+			return;
+		}
+	}
+
+	for( int i=0; i<static_cast<int>(files.size()); i++ )
+	{
+		if( files[i].GetTreeItemHandle() == hTreeItem )
+		{
+			Jenga::Common::EraseVectorItem<Files>( files, i );
+			return;
+		}
+	}
+	throw;
+}
Index: trunk/ab5.0/abdev/abdev/src/ProjectManager/ProjectManager.cpp
===================================================================
--- trunk/ab5.0/abdev/abdev/src/ProjectManager/ProjectManager.cpp	(revision 653)
+++ 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();
 
 	//ブレークポイントのオブジェクトを解放
Index: trunk/ab5.0/abdev/abdev/stdafx.h
===================================================================
--- trunk/ab5.0/abdev/abdev/stdafx.h	(revision 653)
+++ trunk/ab5.0/abdev/abdev/stdafx.h	(revision 655)
@@ -33,4 +33,5 @@
 #include <boost/serialization/nvp.hpp>
 #include <boost/serialization/export.hpp>
+#include <boost/thread/thread.hpp>
 
 #include <jenga/include/jenga.h>
@@ -54,7 +55,7 @@
 #include <Program.h>
 #include <ProjectManager/WindowManager.h>
+#include <ProjectManager/FileManager.h>
 
 #include "Common.h"
 
-#include <ProjectManager/FileManager.h>
 #include <ProjectManager/ProjectManager.h>
