Index: trunk/ab5.0/abdev/abdev/ProjectControl.cpp
===================================================================
--- trunk/ab5.0/abdev/abdev/ProjectControl.cpp	(revision 608)
+++ trunk/ab5.0/abdev/abdev/ProjectControl.cpp	(revision 609)
@@ -180,6 +180,6 @@
 				case IDM_MATERIALTREE_OPEN:
 					hTreeItem=TreeView_GetSelection(hMaterialTreeView);
-					for(i=0;i<ProjectInfo.NumberOfWindows;i++){
-						if(ProjectInfo.pWindowInfo[i].hTreeItem==hTreeItem){
+					for(i=0;i<static_cast<int>(ProjectInfo.windowInfos.size());i++){
+						if(ProjectInfo.windowInfos[i].hTreeItem==hTreeItem){
 							NewRadWindow(i);
 							break;
@@ -247,9 +247,9 @@
 						}
 					}
-					for(i=0;i<ProjectInfo.NumberOfWindows;i++){
-						if(ProjectInfo.pWindowInfo[i].hTreeItem==hTreeItem){
+					for(i=0;i<static_cast<int>(ProjectInfo.windowInfos.size());i++){
+						if(ProjectInfo.windowInfos[i].hTreeItem==hTreeItem){
 
 							//"%s ウィンドウをプロジェクトから削除します。よろしいですか？"
-							sprintf(str,STRING_PJ_CHECK_DELETEWINDOW,ProjectInfo.pWindowInfo[i].name);
+							sprintf(str,STRING_PJ_CHECK_DELETEWINDOW,ProjectInfo.windowInfos[i].name);
 							if(IDCANCEL==MessageBox(hOwner,str,APPLICATION_NAME,MB_OKCANCEL|MB_ICONEXCLAMATION)) break;
 
@@ -1058,31 +1058,32 @@
 		// ウィンドウ定義ファイル（*.wnd）を作成
 		/////////////////////////////////////////
-		WINDOW_INFO WindowInfo[1];
-		WindowInfo[0].name="MainWnd";
-		WindowInfo[0].HandleName="hMainWnd";
-		WindowInfo[0].pos.x=CW_USEDEFAULT;
-		WindowInfo[0].pos.y=CW_USEDEFAULT;
-		WindowInfo[0].size.cx=480;
-		WindowInfo[0].size.cy=360;
-		WindowInfo[0].caption=NewProjectInfo.name;
+		std::vector<WINDOW_INFO> windowInfos;
+		windowInfos.push_back( WINDOW_INFO() );
+		windowInfos.back().name="MainWnd";
+		windowInfos.back().HandleName="hMainWnd";
+		windowInfos.back().pos.x=CW_USEDEFAULT;
+		windowInfos.back().pos.y=CW_USEDEFAULT;
+		windowInfos.back().size.cx=480;
+		windowInfos.back().size.cy=360;
+		windowInfos.back().caption=NewProjectInfo.name;
 		if(NewProjectInfo.dwTypeID==IDC_EXE_WINDOWBASE)
-			WindowInfo[0].style=WS_OVERLAPPED|WS_CAPTION|WS_SYSMENU|WS_THICKFRAME|WS_MINIMIZEBOX|WS_MAXIMIZEBOX|WS_VISIBLE;
+			windowInfos.back().style=WS_OVERLAPPED|WS_CAPTION|WS_SYSMENU|WS_THICKFRAME|WS_MINIMIZEBOX|WS_MAXIMIZEBOX|WS_VISIBLE;
 		else if(NewProjectInfo.dwTypeID==IDC_EXE_DIRECTX)
-			WindowInfo[0].style=WS_OVERLAPPED|WS_THICKFRAME|WS_SYSMENU;
-		WindowInfo[0].ExStyle=0;
-		WindowInfo[0].MenuID=0;
-		WindowInfo[0].id=0;
-		WindowInfo[0].bgColor=COLOR_3DFACE;
-		GetDefaultWindowFont(&WindowInfo[0].LogFont);
-		WindowInfo[0].IconResName=0;
-		WindowInfo[0].ClassName="NORMAL";
-		WindowInfo[0].CallBackName="MainWndProc";
-		WindowInfo[0].type=WNDTYPE_DEFAULT;
-		WindowInfo[0].filepath="MainWnd.ab";
-		WindowInfo[0].NumberOfChildWindows=0;
+			windowInfos.back().style=WS_OVERLAPPED|WS_THICKFRAME|WS_SYSMENU;
+		windowInfos.back().ExStyle=0;
+		windowInfos.back().MenuID=0;
+		windowInfos.back().id=0;
+		windowInfos.back().bgColor=COLOR_3DFACE;
+		GetDefaultWindowFont(&windowInfos.back().LogFont);
+		windowInfos.back().IconResName=0;
+		windowInfos.back().ClassName="NORMAL";
+		windowInfos.back().CallBackName="MainWndProc";
+		windowInfos.back().type=WNDTYPE_DEFAULT;
+		windowInfos.back().filepath="MainWnd.ab";
+		windowInfos.back().NumberOfChildWindows=0;
 		sprintf(temporary,"%s%s.wnd",dir,NewProjectInfo.name);
 
 		ProjectInfo.NumberOfMenu=0;
-		SaveWindowFile(temporary,WindowInfo,1);
+		SaveWindowFile( temporary, windowInfos );
 	}
 
@@ -1209,9 +1210,10 @@
 	tv.hParent=TreeView_InsertItem(hMaterialTreeView,&tv);
 	ProjectInfo.hWindowTreeItem=tv.hParent;
-	for(i=0;i<ProjectInfo.NumberOfWindows;i++){
+	BOOST_FOREACH( WINDOW_INFO &windowInfo, ProjectInfo.windowInfos )
+	{
 		tv.item.iImage=2;
 		tv.item.iSelectedImage=2;
-		tv.item.pszText=ProjectInfo.pWindowInfo[i].name;
-		ProjectInfo.pWindowInfo[i].hTreeItem=TreeView_InsertItem(hMaterialTreeView,&tv);
+		tv.item.pszText = windowInfo.name;
+		windowInfo.hTreeItem=TreeView_InsertItem(hMaterialTreeView,&tv);
 	}
 }
@@ -1253,4 +1255,5 @@
 	//解析
 	ProjectInfo.pobj_DBFileInfo=new CDBFileInfo();
+	bool isUseWindow = false;
 	for(i=0;;i++){
 		if(buffer[i]=='\0') break;
@@ -1324,5 +1327,8 @@
 					temporary[i2]=buffer[i];
 				}
-				ProjectInfo.NumberOfWindows=atoi(temporary);
+				if( atoi(temporary) > 0 )
+				{
+					isUseWindow = true;
+				}
 			}
 			else if(lstrcmpi(temporary,"OPTION")==0&&buffer[i]=='='){
@@ -1450,5 +1456,6 @@
 
 
-	if(ProjectInfo.NumberOfWindows){
+	if( isUseWindow )
+	{
 		/////////////////////////////////////////////
 		//ウィンドウ定義ファイル（*.wnd）をオープン
@@ -1457,5 +1464,5 @@
 	}
 	else{
-		ProjectInfo.pWindowInfo=(WINDOW_INFO *)HeapAlloc(hHeap,HEAP_ZERO_MEMORY,1);
+		ProjectInfo.windowInfos.clear();
 
 		ProjectInfo.NumberOfMenu=0;
@@ -1581,6 +1588,6 @@
 						}
 						else if(lstrcmpi(temporary,"rad")==0){
-							for(i3=0;i3<ProjectInfo.NumberOfWindows;i3++){
-								if(lstrcmpi(ProjectInfo.pWindowInfo[i3].name,temp2)==0){
+							for(i3=0;i3<static_cast<int>(ProjectInfo.windowInfos.size());i3++){
+								if(lstrcmpi(ProjectInfo.windowInfos[i3].name,temp2)==0){
 									NewRadWindow(i3);
 									break;
@@ -1703,6 +1710,6 @@
 						}
 						else if(lstrcmpi(temporary,"rad")==0){
-							for(i3=0;i3<ProjectInfo.NumberOfWindows;i3++){
-								if(lstrcmpi(ProjectInfo.pWindowInfo[i3].name,temp2)==0){
+							for(i3=0;i3<static_cast<int>(ProjectInfo.windowInfos.size());i3++){
+								if(lstrcmpi(ProjectInfo.windowInfos[i3].name,temp2)==0){
 									NewRadWindow(i3);
 									break;
@@ -1897,6 +1904,7 @@
 		}
 		else if(MdiInfo[WndNum].DocType==WNDTYPE_RAD){
-			for(i=0;i<ProjectInfo.NumberOfWindows;i++){
-				if(lstrcmp(MdiInfo[WndNum].path,ProjectInfo.pWindowInfo[i].name)==0){
+			BOOST_FOREACH( const WINDOW_INFO &windowInfo, ProjectInfo.windowInfos )
+			{
+				if(lstrcmp(MdiInfo[WndNum].path, windowInfo.name)==0){
 					SendMessage(hCloseChild,WM_CLOSE,0,0);
 					break;
@@ -1931,28 +1939,29 @@
 
 	//ウィンドウ情報のメモリを解放
-	for(i=0;i<ProjectInfo.NumberOfWindows;i++){
-		HeapDefaultFree(ProjectInfo.pWindowInfo[i].name);
-		HeapDefaultFree(ProjectInfo.pWindowInfo[i].HandleName);
-		HeapDefaultFree(ProjectInfo.pWindowInfo[i].caption);
-		HeapDefaultFree(ProjectInfo.pWindowInfo[i].ClassName);
-		HeapDefaultFree(ProjectInfo.pWindowInfo[i].CallBackName);
-		HeapDefaultFree(ProjectInfo.pWindowInfo[i].filepath);
-		if(ProjectInfo.pWindowInfo[i].MenuID)
-			HeapDefaultFree(ProjectInfo.pWindowInfo[i].MenuID);
-		if(ProjectInfo.pWindowInfo[i].IconResName)
-			HeapDefaultFree(ProjectInfo.pWindowInfo[i].IconResName);
+	BOOST_FOREACH( WINDOW_INFO &windowInfo, ProjectInfo.windowInfos )
+	{
+		HeapDefaultFree(windowInfo.name);
+		HeapDefaultFree(windowInfo.HandleName);
+		HeapDefaultFree(windowInfo.caption);
+		HeapDefaultFree(windowInfo.ClassName);
+		HeapDefaultFree(windowInfo.CallBackName);
+		HeapDefaultFree(windowInfo.filepath);
+		if(windowInfo.MenuID)
+			HeapDefaultFree(windowInfo.MenuID);
+		if(windowInfo.IconResName)
+			HeapDefaultFree(windowInfo.IconResName);
 
 		//子ウィンドウのメモリを解放
-		for(i2=0;i2<ProjectInfo.pWindowInfo[i].NumberOfChildWindows;i2++){
-			HeapDefaultFree(ProjectInfo.pWindowInfo[i].pChildInfo[i2].IdName);
-			HeapDefaultFree(ProjectInfo.pWindowInfo[i].pChildInfo[i2].caption);
-			if(ProjectInfo.pWindowInfo[i].pChildInfo[i2].Control==CT_IMAGEBOX){
+		for(i2=0;i2<windowInfo.NumberOfChildWindows;i2++){
+			HeapDefaultFree(windowInfo.pChildInfo[i2].IdName);
+			HeapDefaultFree(windowInfo.pChildInfo[i2].caption);
+			if(windowInfo.pChildInfo[i2].Control==CT_IMAGEBOX){
 				//イメージ ボックスの場合
-				HeapDefaultFree(ProjectInfo.pWindowInfo[i].pChildInfo[i2].ImageCtrlInfo.path);
-			}
-		}
-		HeapDefaultFree(ProjectInfo.pWindowInfo[i].pChildInfo);
-	}
-	HeapDefaultFree(ProjectInfo.pWindowInfo);
+				HeapDefaultFree(windowInfo.pChildInfo[i2].ImageCtrlInfo.path);
+			}
+		}
+		HeapDefaultFree(windowInfo.pChildInfo);
+	}
+	ProjectInfo.windowInfos.clear();
 
 	//メニュー情報のメモリを解放
@@ -2041,6 +2050,7 @@
 		}
 		else if(MdiInfo[WndNum].DocType==WNDTYPE_RAD){
-			for(i=0;i<ProjectInfo.NumberOfWindows;i++){
-				if(lstrcmpi(MdiInfo[WndNum].path,ProjectInfo.pWindowInfo[i].name)==0){
+			BOOST_FOREACH( WINDOW_INFO &windowInfo, ProjectInfo.windowInfos )
+			{
+				if(lstrcmpi(MdiInfo[WndNum].path,windowInfo.name)==0){
 					sprintf(buffer+i2,"rad,%s\r\n",MdiInfo[WndNum].path);
 					i2+=lstrlen(buffer+i2);
@@ -2178,5 +2188,5 @@
 		i2+=lstrlen(buffer+i2);
 	}
-	sprintf(buffer+i2,"#USEWINDOW=%d\r\n\r\n",ProjectInfo.NumberOfWindows);
+	sprintf(buffer+i2,"#USEWINDOW=%d\r\n\r\n",ProjectInfo.windowInfos.size());
 	i2+=lstrlen(buffer+i2);
 	sprintf(buffer+i2,"#OPTION=&H%08x\r\n\r\n",ProjectInfo.dwOption);
@@ -2312,5 +2322,6 @@
 		}
 	}
-	if(ProjectInfo.NumberOfWindows){
+	if( !ProjectInfo.windowInfos.empty() )
+	{
 		lstrcpy(buffer+i2,"\r\n");
 		i2+=lstrlen(buffer+i2);
@@ -2333,5 +2344,6 @@
 		}
 	}
-	if(ProjectInfo.NumberOfWindows){
+	if( !ProjectInfo.windowInfos.empty() )
+	{
 		lstrcpy(buffer+i2,"\r\n");
 		i2+=lstrlen(buffer+i2);
@@ -2358,10 +2370,11 @@
 
 
-	if(ProjectInfo.NumberOfWindows){
+	if( !ProjectInfo.windowInfos.empty() )
+	{
 		/////////////////////////////////////////////////////
 		//ウィンドウ関連ファイル（*.wnd）を作成、保存
 		if(ProjectInfo.ModifyOfMaterial){
 			sprintf(temporary,"%s%s.wnd",ProjectInfo.dir,ProjectInfo.name);
-			SaveWindowFile(temporary,ProjectInfo.pWindowInfo,ProjectInfo.NumberOfWindows);
+			SaveWindowFile( temporary, ProjectInfo.windowInfos );
 		}
 
@@ -2438,5 +2451,6 @@
 			SourceTime.dwLowDateTime>ExeTime.dwLowDateTime) return 1;
 	}
-	if(ProjectInfo.NumberOfWindows){
+	if( !ProjectInfo.windowInfos.empty() )
+	{
 		//CallBack.wbp
 		lstrcpy(temporary,"CallBack.wbp");
