Index: trunk/ab5.0/abdev/abdev/RadProc.cpp
===================================================================
--- trunk/ab5.0/abdev/abdev/RadProc.cpp	(revision 624)
+++ trunk/ab5.0/abdev/abdev/RadProc.cpp	(revision 625)
@@ -8,5 +8,4 @@
 	extern HINSTANCE hInst,hResInst;
 	extern HWND hDocCombo;
-	extern MDIINFO MdiInfo[MAX_WNDNUM];
 	int i,i2;
 	HWND hChild;
@@ -19,5 +18,5 @@
 		i=GetWndNum(hChild);
 		if(MdiInfo[i].DocType==WNDTYPE_RAD){
-			if(lstrcmpi(MdiInfo[i].path,windowInfo.GetName().c_str())==0) break;
+			if(lstrcmpi(MdiInfo[i].path.c_str(),windowInfo.GetName().c_str())==0) break;
 		}
 		hChild=GetNextWindow(hChild,GW_HWNDNEXT);
@@ -81,57 +80,53 @@
 	//ウィンドウのID登録
 	HDC hdc;
-	for(i=0;i<MAX_WNDNUM;i++){
-		if(MdiInfo[i].hwnd==0){
-			MdiInfo[i].hwnd=hChild;
-			MdiInfo[i].DocType=WNDTYPE_RAD;
-			MdiInfo[i].title=(char *)GlobalAlloc(GMEM_FIXED,windowInfo.GetName().size()+1);
-			lstrcpy(MdiInfo[i].title,windowInfo.GetName().c_str());
-			MdiInfo[i].path=(char *)GlobalAlloc(GMEM_FIXED,windowInfo.GetName().size()+1);
-			lstrcpy(MdiInfo[i].path,windowInfo.GetName().c_str());
-
-
-			////////////////////////////
-			// MDIRADINFO構造体をセット
-			////////////////////////////
-
-			MdiInfo[i].MdiRadInfo=(MDIRADINFO *)GlobalAlloc(GPTR,sizeof(MDIRADINFO));
-
-			MdiInfo[i].MdiRadInfo->hTools=hTools;
-			MdiInfo[i].MdiRadInfo->hProperty=hProperty;
-			MdiInfo[i].MdiRadInfo->hProp_Dlg=CreateDialog(hResInst,MAKEINTRESOURCE(IDD_RAD_PROP_WINDOW),hProperty,(DLGPROC)RadProperty_WindowProc);
-
-			SCROLLINFO ScrollInfo;
-			ScrollInfo.cbSize=sizeof(SCROLLINFO);
-			ScrollInfo.fMask=SIF_POS;
-			ScrollInfo.nPos=0;
-			SetScrollInfo(MdiInfo[i].MdiRadInfo->hProperty,SB_VERT,&ScrollInfo,1);
-
-			MdiInfo[i].MdiRadInfo->hRad=hRad;
-
-			MdiInfo[i].MdiRadInfo->hSupport=hSupport;
-
-			hdc=GetDC(hRad);
-			MdiInfo[i].MdiRadInfo->hBitmap=CreateCompatibleBitmap(hdc,ScreenX*2,ScreenY*2);
-			MdiInfo[i].MdiRadInfo->hMemDC=CreateCompatibleDC(hdc);
-			MdiInfo[i].MdiRadInfo->hOldBitmap=
-				(HBITMAP)SelectObject(MdiInfo[i].MdiRadInfo->hMemDC,MdiInfo[i].MdiRadInfo->hBitmap);
-			ReleaseDC(hRad,hdc);
-
-			for(i2=0;i2<MAX_RAD_SELITEM;i2++) MdiInfo[i].MdiRadInfo->SelectingItem[i2]=-1;
-			MdiInfo[i].MdiRadInfo->ButtonSelect=IDC_TOOL_MOUSE;
-
-			//変更情報を初期化
-			MdiInfo[i].MdiRadInfo->undo.NowPos=0;
-			memset(MdiInfo[i].MdiRadInfo->undo.Command,0,sizeof(int)*MAX_UNDONUM);
-
-
-			DrawRadWindow(i,&windowInfo);
-
-			//サポートダイアログの内容をセット
-			SetSupportDlgData(i,windowInfo);
-
-			break;
-		}
-	}
+	MdiInfo.push_back( MDIINFO() );
+	i = MdiInfo.size()-1;
+
+	MdiInfo[i].hwnd=hChild;
+	MdiInfo[i].DocType=WNDTYPE_RAD;
+	MdiInfo[i].title=(char *)GlobalAlloc(GMEM_FIXED,windowInfo.GetName().size()+1);
+	lstrcpy(MdiInfo[i].title,windowInfo.GetName().c_str());
+	MdiInfo[i].path = windowInfo.GetName();
+
+
+	////////////////////////////
+	// MDIRADINFO構造体をセット
+	////////////////////////////
+
+	MdiInfo[i].MdiRadInfo=(MDIRADINFO *)GlobalAlloc(GPTR,sizeof(MDIRADINFO));
+
+	MdiInfo[i].MdiRadInfo->hTools=hTools;
+	MdiInfo[i].MdiRadInfo->hProperty=hProperty;
+	MdiInfo[i].MdiRadInfo->hProp_Dlg=CreateDialog(hResInst,MAKEINTRESOURCE(IDD_RAD_PROP_WINDOW),hProperty,(DLGPROC)RadProperty_WindowProc);
+
+	SCROLLINFO ScrollInfo;
+	ScrollInfo.cbSize=sizeof(SCROLLINFO);
+	ScrollInfo.fMask=SIF_POS;
+	ScrollInfo.nPos=0;
+	SetScrollInfo(MdiInfo[i].MdiRadInfo->hProperty,SB_VERT,&ScrollInfo,1);
+
+	MdiInfo[i].MdiRadInfo->hRad=hRad;
+
+	MdiInfo[i].MdiRadInfo->hSupport=hSupport;
+
+	hdc=GetDC(hRad);
+	MdiInfo[i].MdiRadInfo->hBitmap=CreateCompatibleBitmap(hdc,ScreenX*2,ScreenY*2);
+	MdiInfo[i].MdiRadInfo->hMemDC=CreateCompatibleDC(hdc);
+	MdiInfo[i].MdiRadInfo->hOldBitmap=
+		(HBITMAP)SelectObject(MdiInfo[i].MdiRadInfo->hMemDC,MdiInfo[i].MdiRadInfo->hBitmap);
+	ReleaseDC(hRad,hdc);
+
+	for(i2=0;i2<MAX_RAD_SELITEM;i2++) MdiInfo[i].MdiRadInfo->SelectingItem[i2]=-1;
+	MdiInfo[i].MdiRadInfo->ButtonSelect=IDC_TOOL_MOUSE;
+
+	//変更情報を初期化
+	MdiInfo[i].MdiRadInfo->undo.NowPos=0;
+	memset(MdiInfo[i].MdiRadInfo->undo.Command,0,sizeof(int)*MAX_UNDONUM);
+
+	DrawRadWindow(i,&windowInfo);
+
+	//サポートダイアログの内容をセット
+	SetSupportDlgData(i,windowInfo);
+
 
 	ShowWindow(hSupport,SW_SHOW);
@@ -160,5 +155,4 @@
 
 	extern HANDLE hHeap;
-	extern MDIINFO MdiInfo[MAX_WNDNUM];
 	int i,i2,NewItemNum;
 	char temporary[MAX_PATH];
@@ -271,5 +265,4 @@
 void DeleteDlgItem(int WndNum,int WndInfoNum,int ItemNum,BOOL bNoticeChanging){
 	extern HANDLE hHeap;
-	extern MDIINFO MdiInfo[MAX_WNDNUM];
 
 	ActiveBasic::PM::WindowInfo *pWindowInfo = projectInfo.windowInfos[WndInfoNum];
@@ -335,5 +328,4 @@
 }
 void DrawFrame(HWND hwnd,int WndNum,int WndInfoNum,RECT *NewRect,RECT *OldRect,BOOL bLA){
-	extern MDIINFO MdiInfo[MAX_WNDNUM];
 	static int swLineStop;
 	int i,sw;
@@ -446,5 +438,4 @@
 }
 void GetSelectingRect(int WndNum,int WndInfoNum,int num,RECT *rect){
-	extern MDIINFO MdiInfo[MAX_WNDNUM];
 
 	ActiveBasic::PM::WindowInfo *pWindowInfo = projectInfo.windowInfos[WndInfoNum];
@@ -466,5 +457,4 @@
 }
 void DrawSelectingRect(HWND hwnd,int WndNum,int WndInfoNum,int ButtonSelect){
-	extern MDIINFO MdiInfo[MAX_WNDNUM];
 	extern RADINFO RadInfo;
 	int i,i2,i3;
@@ -541,5 +531,4 @@
 }
 void ChangePropertyWindow(int WndNum,int WndInfoNum){
-	extern MDIINFO MdiInfo[MAX_WNDNUM];
 	RECT rect;
 	SCROLLINFO ScrollInfo;
@@ -603,5 +592,4 @@
 }
 int GetItemNumOnMouse(int WndNum,int WndInfoNum,int x,int y){
-	extern MDIINFO MdiInfo[MAX_WNDNUM];
 	int i;
 
@@ -648,5 +636,4 @@
 void SelectItemNumOnMouse(int WndNum,int WndInfoNum,int x,int y){
 	//マウス座標をもとにコントロールアイテムを選択
-	extern MDIINFO MdiInfo[MAX_WNDNUM];
 	int i;
 
@@ -671,5 +658,4 @@
 }
 void SetItemNumOnFrame(int WndNum,int WndInfoNum,RECT *pRect){
-	extern MDIINFO MdiInfo[MAX_WNDNUM];
 	int i,i2,sw;
 	RECT rect;
@@ -696,5 +682,4 @@
 }
 int GetStateOfDraggingFrame(int WndNum,int WndInfoNum,int x,int y){
-	extern MDIINFO MdiInfo[MAX_WNDNUM];
 	int i;
 	RECT rect;
@@ -757,5 +742,4 @@
 }
 void ResetScrollbarOfRadEditor(int WndNum,int weight,int height){
-	extern MDIINFO MdiInfo[MAX_WNDNUM];
 	SCROLLINFO ScrollInfo;
 	SIZE NeedSize;
@@ -791,5 +775,4 @@
 }
 LRESULT CALLBACK RadWindow(HWND hwnd,UINT message,WPARAM wParam,LPARAM lParam){
-	extern MDIINFO MdiInfo[MAX_WNDNUM];
 	extern RADINFO RadInfo;
 	int i,i2,i3,i4;
@@ -1964,5 +1947,4 @@
 }
 void ResizeToRadToolWindows(int WndNum,int weight,int height){
-	extern MDIINFO MdiInfo[MAX_WNDNUM];
 	int i,i2;
 	RECT rect;
@@ -2002,5 +1984,4 @@
 LRESULT CALLBACK MDIClientWindow_Rad(HWND hwnd,UINT message,WPARAM wParam,LPARAM lParam){
 	extern HWND hDocCombo;
-	extern MDIINFO MdiInfo[MAX_WNDNUM];
 	int i,WndNum;
 
