Index: trunk/ab5.0/abdev/abdev/WindowControl.cpp
===================================================================
--- trunk/ab5.0/abdev/abdev/WindowControl.cpp	(revision 615)
+++ trunk/ab5.0/abdev/abdev/WindowControl.cpp	(revision 616)
@@ -70,5 +70,4 @@
 	BYTE *pByte;
 	int i2,i3,MemSize;
-	CHILDINFO *pChildInfo;
 
 	for(i3=0;;i3++){
@@ -86,5 +85,5 @@
 
 	for(i3--;i3>=0;i3--){
-		pChildInfo=&ProjectInfo.windowInfos[WndInfoNum]->pChildInfo[MdiInfo[WndNum].MdiRadInfo->SelectingItem[i3]];
+		CHILDINFO *pChildInfo = ProjectInfo.windowInfos[WndInfoNum]->childWindowInfos[MdiInfo[WndNum].MdiRadInfo->SelectingItem[i3]];
 
 		MemSize+=lstrlen(pChildInfo->IdName)+1+
@@ -557,47 +556,49 @@
 
 		//子ウィンドウ作成
-		for(i2=0,sw=0;i2<pWindowInfo->NumberOfChildWindows;i2++){
-			if(pWindowInfo->pChildInfo[i2].Control==CT_UPDOWN){
+		sw = 0;
+		BOOST_FOREACH( const CHILDINFO *pChildInfo, pWindowInfo->childWindowInfos )
+		{
+			if(pChildInfo->Control==CT_UPDOWN){
 				sprintf(Command+i,"%s\tCreateUpDownControl(%d,%d,%d,%d,%d,hWnd,%s,GetWindowLongPtr(hWnd,GWLP_HINSTANCE) As HINSTANCE,0,0,100,0)\r\n",
 					spaces,
-					pWindowInfo->pChildInfo[i2].style,
-					pWindowInfo->pChildInfo[i2].pos.x,pWindowInfo->pChildInfo[i2].pos.y,
-					pWindowInfo->pChildInfo[i2].size.cx,pWindowInfo->pChildInfo[i2].size.cy,
-					pWindowInfo->pChildInfo[i2].IdName);
+					pChildInfo->style,
+					pChildInfo->pos.x,pChildInfo->pos.y,
+					pChildInfo->size.cx,pChildInfo->size.cy,
+					pChildInfo->IdName);
 				i+=lstrlen(Command+i);
 			}
 			else{
-				GetItemClassName(temporary,pWindowInfo->pChildInfo[i2].Control);
-				temp2=FormatCaption(pWindowInfo->pChildInfo[i2].caption);
+				GetItemClassName(temporary,pChildInfo->Control);
+				temp2=FormatCaption(pChildInfo->caption);
 				sprintf(Command+i,"%s\tCreateWindowEx(&H%08x,\"%s\",\"%s\",&H%08x,%d,%d,%d,%d,hWnd,%s As HMENU,GetModuleHandle(0),0)\r\n",
 					spaces,
-					pWindowInfo->pChildInfo[i2].ExStyle,
+					pChildInfo->ExStyle,
 					temporary,
 					temp2,
-					pWindowInfo->pChildInfo[i2].style,
-					pWindowInfo->pChildInfo[i2].pos.x,
-					pWindowInfo->pChildInfo[i2].pos.y,
-					pWindowInfo->pChildInfo[i2].size.cx,
-					pWindowInfo->pChildInfo[i2].size.cy,
-					pWindowInfo->pChildInfo[i2].IdName);
+					pChildInfo->style,
+					pChildInfo->pos.x,
+					pChildInfo->pos.y,
+					pChildInfo->size.cx,
+					pChildInfo->size.cy,
+					pChildInfo->IdName);
 				i+=lstrlen(Command+i);
 				HeapDefaultFree(temp2);
 				sprintf(Command+i,"%s\tSendMessage(GetDlgItem(hWnd,%s),WM_SETFONT,hFont_%s As WPARAM,0)\r\n",
 					spaces,
-					pWindowInfo->pChildInfo[i2].IdName,
+					pChildInfo->IdName,
 					pWindowInfo->name);
 				i+=lstrlen(Command+i);
 
-				if(pWindowInfo->pChildInfo[i2].Control==CT_IMAGEBOX){
+				if(pChildInfo->Control==CT_IMAGEBOX){
 					//イメージ ボックスの場合
-					if((pWindowInfo->pChildInfo[i2].style&0x000F)==SS_ICON){
-						if(pWindowInfo->pChildInfo[i2].ImageCtrlInfo.type==IMGTYPE_FILE){
-							if(strstr(pWindowInfo->pChildInfo[i2].ImageCtrlInfo.path,":")||
-								strstr(pWindowInfo->pChildInfo[i2].ImageCtrlInfo.path,"\\\\")){
+					if((pChildInfo->style&0x000F)==SS_ICON){
+						if(pChildInfo->ImageCtrlInfo.type==IMGTYPE_FILE){
+							if(strstr(pChildInfo->ImageCtrlInfo.path,":")||
+								strstr(pChildInfo->ImageCtrlInfo.path,"\\\\")){
 								sprintf(Command+i,"%s\thImage_%s_%s=LoadImage(GetWindowLongPtr(hWnd,GWLP_HINSTANCE) As HINSTANCE,\"%s\",IMAGE_ICON,0,0,LR_DEFAULTSIZE or LR_LOADFROMFILE)\r\n",
 									spaces,
 									pWindowInfo->name,
-									pWindowInfo->pChildInfo[i2].IdName,
-									pWindowInfo->pChildInfo[i2].ImageCtrlInfo.path);
+									pChildInfo->IdName,
+									pChildInfo->ImageCtrlInfo.path);
 							}
 							else{
@@ -623,37 +624,37 @@
 									i+=2;
 								}
-								sprintf(Command+i,"%s\twsprintf(ImageFilePath,\"%%s%s\",ModulePath)\r\n",spaces,pWindowInfo->pChildInfo[i2].ImageCtrlInfo.path);
+								sprintf(Command+i,"%s\twsprintf(ImageFilePath,\"%%s%s\",ModulePath)\r\n",spaces,pChildInfo->ImageCtrlInfo.path);
 								i+=lstrlen(Command+i);
 								sprintf(Command+i,"%s\thImage_%s_%s=LoadImage(GetWindowLongPtr(hWnd,GWLP_HINSTANCE) As HINSTANCE,ImageFilePath,IMAGE_ICON,0,0,LR_DEFAULTSIZE or LR_LOADFROMFILE)\r\n",
 									spaces,
 									pWindowInfo->name,
-									pWindowInfo->pChildInfo[i2].IdName);
+									pChildInfo->IdName);
 							}
 							i+=lstrlen(Command+i);
 						}
-						else if(pWindowInfo->pChildInfo[i2].ImageCtrlInfo.type==IMGTYPE_RES){
+						else if(pChildInfo->ImageCtrlInfo.type==IMGTYPE_RES){
 							sprintf(Command+i,"%s\thImage_%s_%s=LoadImage(GetWindowLongPtr(hWnd,GWLP_HINSTANCE) As HINSTANCE,%s As *Byte,IMAGE_ICON,0,0,LR_DEFAULTSIZE)\r\n",
 								spaces,
 								pWindowInfo->name,
-								pWindowInfo->pChildInfo[i2].IdName,
-								pWindowInfo->pChildInfo[i2].ImageCtrlInfo.path);
+								pChildInfo->IdName,
+								pChildInfo->ImageCtrlInfo.path);
 							i+=lstrlen(Command+i);
 						}
 						sprintf(Command+i,"%s\tSendMessage(GetDlgItem(hWnd,%s),STM_SETICON,hImage_%s_%s As WPARAM,0)\r\n",
 							spaces,
-							pWindowInfo->pChildInfo[i2].IdName,
+							pChildInfo->IdName,
 							pWindowInfo->name,
-							pWindowInfo->pChildInfo[i2].IdName);
+							pChildInfo->IdName);
 						i+=lstrlen(Command+i);
 					}
-					else if((pWindowInfo->pChildInfo[i2].style&0x000F)==SS_BITMAP){
-						if(pWindowInfo->pChildInfo[i2].ImageCtrlInfo.type==IMGTYPE_FILE){
-							if(strstr(pWindowInfo->pChildInfo[i2].ImageCtrlInfo.path,":")||
-								strstr(pWindowInfo->pChildInfo[i2].ImageCtrlInfo.path,"\\\\")){
+					else if((pChildInfo->style&0x000F)==SS_BITMAP){
+						if(pChildInfo->ImageCtrlInfo.type==IMGTYPE_FILE){
+							if(strstr(pChildInfo->ImageCtrlInfo.path,":")||
+								strstr(pChildInfo->ImageCtrlInfo.path,"\\\\")){
 								sprintf(Command+i,"%s\thImage_%s_%s=LoadImage(GetWindowLongPtr(hWnd,GWLP_HINSTANCE) As HINSTANCE,\"%s\",IMAGE_BITMAP,0,0,LR_DEFAULTSIZE or LR_LOADFROMFILE)\r\n",
 									spaces,
 									pWindowInfo->name,
-									pWindowInfo->pChildInfo[i2].IdName,
-									pWindowInfo->pChildInfo[i2].ImageCtrlInfo.path);
+									pChildInfo->IdName,
+									pChildInfo->ImageCtrlInfo.path);
 							}
 							else{
@@ -679,26 +680,26 @@
 									i+=2;
 								}
-								sprintf(Command+i,"%s\twsprintf(ImageFilePath,\"%%s%s\",ModulePath)\r\n",spaces,pWindowInfo->pChildInfo[i2].ImageCtrlInfo.path);
+								sprintf(Command+i,"%s\twsprintf(ImageFilePath,\"%%s%s\",ModulePath)\r\n",spaces,pChildInfo->ImageCtrlInfo.path);
 								i+=lstrlen(Command+i);
 								sprintf(Command+i,"%s\thImage_%s_%s=LoadImage(GetWindowLongPtr(hWnd,GWLP_HINSTANCE) As HINSTANCE,ImageFilePath,IMAGE_BITMAP,0,0,LR_LOADFROMFILE)\r\n",
 									spaces,
 									pWindowInfo->name,
-									pWindowInfo->pChildInfo[i2].IdName);
+									pChildInfo->IdName);
 							}
 							i+=lstrlen(Command+i);
 						}
-						else if(pWindowInfo->pChildInfo[i2].ImageCtrlInfo.type==IMGTYPE_RES){
+						else if(pChildInfo->ImageCtrlInfo.type==IMGTYPE_RES){
 							sprintf(Command+i,"%s\thImage_%s_%s=LoadImage(GetWindowLongPtr(hWnd,GWLP_HINSTANCE) As HINSTANCE,%s As *Byte,IMAGE_BITMAP,0,0,LR_DEFAULTSIZE)\r\n",
 								spaces,
 								pWindowInfo->name,
-								pWindowInfo->pChildInfo[i2].IdName,
-								pWindowInfo->pChildInfo[i2].ImageCtrlInfo.path);
+								pChildInfo->IdName,
+								pChildInfo->ImageCtrlInfo.path);
 							i+=lstrlen(Command+i);
 						}
 						sprintf(Command+i,"%s\tSendMessage(GetDlgItem(hWnd,%s),STM_SETIMAGE,IMAGE_BITMAP,hImage_%s_%s As LPARAM)\r\n",
 							spaces,
-							pWindowInfo->pChildInfo[i2].IdName,
+							pChildInfo->IdName,
 							pWindowInfo->name,
-							pWindowInfo->pChildInfo[i2].IdName);
+							pChildInfo->IdName);
 						i+=lstrlen(Command+i);
 					}
@@ -731,10 +732,11 @@
 
 		//イメージ ボックス用の変数を解放
-		for(i2=0;i2<pWindowInfo->NumberOfChildWindows;i2++){
-			if(pWindowInfo->pChildInfo[i2].Control==CT_IMAGEBOX){
-				if((pWindowInfo->pChildInfo[i2].style&0x000F)==SS_ICON)
-					sprintf(Command+i,"%s\tDestroyIcon(hImage_%s_%s)\r\n",spaces,pWindowInfo->name,pWindowInfo->pChildInfo[i2].IdName);
-				else if((pWindowInfo->pChildInfo[i2].style&0x000F)==SS_BITMAP)
-					sprintf(Command+i,"%s\tDeleteObject(hImage_%s_%s)\r\n",spaces,pWindowInfo->name,pWindowInfo->pChildInfo[i2].IdName);
+		BOOST_FOREACH( const CHILDINFO *pChildInfo, pWindowInfo->childWindowInfos )
+		{
+			if(pChildInfo->Control==CT_IMAGEBOX){
+				if((pChildInfo->style&0x000F)==SS_ICON)
+					sprintf(Command+i,"%s\tDestroyIcon(hImage_%s_%s)\r\n",spaces,pWindowInfo->name,pChildInfo->IdName);
+				else if((pChildInfo->style&0x000F)==SS_BITMAP)
+					sprintf(Command+i,"%s\tDeleteObject(hImage_%s_%s)\r\n",spaces,pWindowInfo->name,pChildInfo->IdName);
 				i+=lstrlen(Command+i);
 			}
@@ -1005,9 +1007,9 @@
 	BOOST_FOREACH( WindowInfo *pWindowInfo, ProjectInfo.windowInfos )
 	{
-		for(i3=0;i3<pWindowInfo->NumberOfChildWindows;i3++){
-
+		BOOST_FOREACH( const CHILDINFO *pChildInfo, pWindowInfo->childWindowInfos )
+		{
 			//重複チェック
 			for(i6=0,sw1=0;i6<i5;i6++){
-				if(lstrcmpi(ppNames[i6],pWindowInfo->pChildInfo[i3].IdName)==0){
+				if(lstrcmpi(ppNames[i6],pChildInfo->IdName)==0){
 					sw1=1;
 					break;
@@ -1017,8 +1019,8 @@
 
 			ppNames=(char **)HeapReAlloc(hHeap,0,ppNames,sizeof(char *)*(i5+1));
-			ppNames[i5]=pWindowInfo->pChildInfo[i3].IdName;
+			ppNames[i5]=pChildInfo->IdName;
 			i5++;
 
-			sprintf(buffer+i2,"Const %s=%d\r\n",pWindowInfo->pChildInfo[i3].IdName,i4);
+			sprintf(buffer+i2,"Const %s=%d\r\n",pChildInfo->IdName,i4);
 			i2+=lstrlen(buffer+i2);
 			i4++;
@@ -1104,9 +1106,10 @@
 	BOOST_FOREACH( WindowInfo *pWindowInfo, ProjectInfo.windowInfos )
 	{
-		for(i3=0;i3<pWindowInfo->NumberOfChildWindows;i3++){
-			if(pWindowInfo->pChildInfo[i3].Control==CT_IMAGEBOX){
-				if((pWindowInfo->pChildInfo[i3].style&0x000F)==SS_ICON||
-					(pWindowInfo->pChildInfo[i3].style&0x000F)==SS_BITMAP){
-					sprintf(buffer+i2,"Dim hImage_%s_%s As HANDLE\r\n",pWindowInfo->name,pWindowInfo->pChildInfo[i3].IdName);
+		BOOST_FOREACH( const CHILDINFO *pChildInfo, pWindowInfo->childWindowInfos )
+		{
+			if(pChildInfo->Control==CT_IMAGEBOX){
+				if((pChildInfo->style&0x000F)==SS_ICON||
+					(pChildInfo->style&0x000F)==SS_BITMAP){
+					sprintf(buffer+i2,"Dim hImage_%s_%s As HANDLE\r\n",pWindowInfo->name,pChildInfo->IdName);
 					i2+=lstrlen(buffer+i2);
 
@@ -1627,5 +1630,5 @@
 	extern HANDLE hHeap;
 	extern MDIINFO MdiInfo[MAX_WNDNUM];
-	int i,i2,i3,size;
+	int i,i2,size;
 	char *buffer,*temporary;
 
@@ -1685,19 +1688,20 @@
 		sprintf(buffer+i2,"    FILEPATH  = %s\r\n",pWindowInfo->filepath);
 		i2+=lstrlen(buffer+i2);
-		for(i3=0;i3<pWindowInfo->NumberOfChildWindows;i3++){
-			temporary=SetCaptionSequence(pWindowInfo->pChildInfo[i3].caption);
+		BOOST_FOREACH( const CHILDINFO *pChildInfo, pWindowInfo->childWindowInfos )
+		{
+			temporary=SetCaptionSequence(pChildInfo->caption);
 			sprintf(buffer+i2,"    ITEM      = %s,%d,%d,%d,%d,\"%s\",&H%08x,&H%08x,%d",
-				pWindowInfo->pChildInfo[i3].IdName,
-				pWindowInfo->pChildInfo[i3].pos.x,pWindowInfo->pChildInfo[i3].pos.y,
-				pWindowInfo->pChildInfo[i3].size.cx,pWindowInfo->pChildInfo[i3].size.cy,
+				pChildInfo->IdName,
+				pChildInfo->pos.x,pChildInfo->pos.y,
+				pChildInfo->size.cx,pChildInfo->size.cy,
 				temporary,
-				pWindowInfo->pChildInfo[i3].style,
-				pWindowInfo->pChildInfo[i3].ExStyle,
-				pWindowInfo->pChildInfo[i3].Control
+				pChildInfo->style,
+				pChildInfo->ExStyle,
+				pChildInfo->Control
 			);
 			i2+=lstrlen(buffer+i2);
 			HeapDefaultFree(temporary);
-			if(pWindowInfo->pChildInfo[i3].Control==CT_IMAGEBOX){
-				sprintf(buffer+i2,",%d,\"%s\"",pWindowInfo->pChildInfo[i3].ImageCtrlInfo.type,pWindowInfo->pChildInfo[i3].ImageCtrlInfo.path);
+			if(pChildInfo->Control==CT_IMAGEBOX){
+				sprintf(buffer+i2,",%d,\"%s\"",pChildInfo->ImageCtrlInfo.type,pChildInfo->ImageCtrlInfo.path);
 				i2+=lstrlen(buffer+i2);
 			}
@@ -1829,5 +1833,4 @@
 	int i,i2,i3,i4,i5;
 	char *buffer,temporary[MAX_PATH],*temp2,temp3[MAX_PATH];
-	CHILDINFO *pChildInfo;
 
 	buffer=ReadBuffer(path);
@@ -1881,7 +1884,4 @@
 				ProjectInfo.windowInfos.back()->name=(char *)HeapAlloc(hHeap,0,i2+1);
 				lstrcpy(ProjectInfo.windowInfos.back()->name,temp2);
-
-				ProjectInfo.windowInfos.back()->NumberOfChildWindows=0;
-				ProjectInfo.windowInfos.back()->pChildInfo=(CHILDINFO *)HeapAlloc(hHeap,HEAP_ZERO_MEMORY,1);
 			}
 			else if(lstrcmpi(temporary,"HANDLE")==0&&i3==1){
@@ -1992,6 +1992,5 @@
 			}
 			else if(lstrcmpi(temporary,"ITEM")==0&&i3==1){
-				ProjectInfo.windowInfos.back()->pChildInfo=(CHILDINFO *)HeapReAlloc(hHeap,HEAP_ZERO_MEMORY,ProjectInfo.windowInfos.back()->pChildInfo,(ProjectInfo.windowInfos.back()->NumberOfChildWindows+1)*sizeof(CHILDINFO));
-				pChildInfo=&ProjectInfo.windowInfos.back()->pChildInfo[ProjectInfo.windowInfos.back()->NumberOfChildWindows];
+				CHILDINFO *pChildInfo = new CHILDINFO();
 
 				//ID
@@ -2039,5 +2038,5 @@
 				}
 
-				ProjectInfo.windowInfos.back()->NumberOfChildWindows++;
+				ProjectInfo.windowInfos.back()->childWindowInfos.push_back( pChildInfo );
 			}
 
@@ -2266,8 +2265,4 @@
 	ProjectInfo.windowInfos.back()->type=NewWindow.type;
 
-	//子ウィンドウ情報
-	ProjectInfo.windowInfos.back()->NumberOfChildWindows=0;
-	ProjectInfo.windowInfos.back()->pChildInfo=(CHILDINFO *)HeapAlloc(hHeap,HEAP_ZERO_MEMORY,1);
-
 
 	//メッセージ処理ファイル名
@@ -2346,9 +2341,10 @@
 
 	//子ウィンドウのメモリを解放
-	for(i=0;i<pWindowInfo->NumberOfChildWindows;i++){
-		HeapDefaultFree(pWindowInfo->pChildInfo[i].IdName);
-		HeapDefaultFree(pWindowInfo->pChildInfo[i].caption);
-	}
-	HeapDefaultFree(pWindowInfo->pChildInfo);
+	for(i=0;i<pWindowInfo->childWindowInfos.size();i++){
+		HeapDefaultFree(pWindowInfo->childWindowInfos[i]->IdName);
+		HeapDefaultFree(pWindowInfo->childWindowInfos[i]->caption);
+		delete pWindowInfo->childWindowInfos[i];
+	}
+	pWindowInfo->childWindowInfos.clear();
 
 	//ツリービューから削除
