Index: trunk/ab5.0/abdev/abdev/IconEditor.cpp
===================================================================
--- trunk/ab5.0/abdev/abdev/IconEditor.cpp	(revision 626)
+++ trunk/ab5.0/abdev/abdev/IconEditor.cpp	(revision 629)
@@ -34,8 +34,8 @@
 	BITMAPINFOHEADER *pBmpInfoHdr;
 
-	hCombo=GetDlgItem(MdiInfo[WndNum].MdiIconEditInfo->hToolDlg,IDC_ICONTYPECOMBO);
-
-	for(i=0;i<MdiInfo[WndNum].MdiIconEditInfo->num;i++){
-		pBmpInfoHdr=(BITMAPINFOHEADER *)MdiInfo[WndNum].MdiIconEditInfo->pIconImage[i];
+	hCombo=GetDlgItem(MdiInfo[WndNum]->MdiIconEditInfo->hToolDlg,IDC_ICONTYPECOMBO);
+
+	for(i=0;i<MdiInfo[WndNum]->MdiIconEditInfo->num;i++){
+		pBmpInfoHdr=(BITMAPINFOHEADER *)MdiInfo[WndNum]->MdiIconEditInfo->pIconImage[i];
 
 		//例: "32*32 (xxxx色)"
@@ -147,26 +147,26 @@
 	}
 
-	MdiInfo[WndNum].MdiIconEditInfo->pIconImage[MdiInfo[WndNum].MdiIconEditInfo->num]=
+	MdiInfo[WndNum]->MdiIconEditInfo->pIconImage[MdiInfo[WndNum]->MdiIconEditInfo->num]=
 		CreateIconType(IconType,
-		&MdiInfo[WndNum].MdiIconEditInfo->dwBytesInRes[MdiInfo[WndNum].MdiIconEditInfo->num]);
+		&MdiInfo[WndNum]->MdiIconEditInfo->dwBytesInRes[MdiInfo[WndNum]->MdiIconEditInfo->num]);
 
 	//イメージ選択用のメモリを解放
-	if(MdiInfo[WndNum].MdiIconEditInfo->SelectLevel==2)
-		DeleteObject(MdiInfo[WndNum].MdiIconEditInfo->hSelectingBmp);
-	MdiInfo[WndNum].MdiIconEditInfo->SelectLevel=0;
+	if(MdiInfo[WndNum]->MdiIconEditInfo->SelectLevel==2)
+		DeleteObject(MdiInfo[WndNum]->MdiIconEditInfo->hSelectingBmp);
+	MdiInfo[WndNum]->MdiIconEditInfo->SelectLevel=0;
 
 	//アイコンタイプを追加
-	MdiInfo[WndNum].MdiIconEditInfo->SelectIconNum=MdiInfo[WndNum].MdiIconEditInfo->num;
-	MdiInfo[WndNum].MdiIconEditInfo->num++;
+	MdiInfo[WndNum]->MdiIconEditInfo->SelectIconNum=MdiInfo[WndNum]->MdiIconEditInfo->num;
+	MdiInfo[WndNum]->MdiIconEditInfo->num++;
 
 	//変更情報を初期化
-	i=MdiInfo[WndNum].MdiIconEditInfo->SelectIconNum;
-	MdiInfo[WndNum].MdiIconEditInfo->undo[i].NowPos=0;
-	memset(MdiInfo[WndNum].MdiIconEditInfo->undo[i].lpData,0,sizeof(BYTE *)*MAX_ICONEDIT_UNDONUM);
+	i=MdiInfo[WndNum]->MdiIconEditInfo->SelectIconNum;
+	MdiInfo[WndNum]->MdiIconEditInfo->undo[i].NowPos=0;
+	memset(MdiInfo[WndNum]->MdiIconEditInfo->undo[i].lpData,0,sizeof(BYTE *)*MAX_ICONEDIT_UNDONUM);
 
 	//アイコンタイプコンボボックスに追加
 	char temporary[32];
 	HWND hCombo;
-	hCombo=GetDlgItem(MdiInfo[WndNum].MdiIconEditInfo->hToolDlg,IDC_ICONTYPECOMBO);
+	hCombo=GetDlgItem(MdiInfo[WndNum]->MdiIconEditInfo->hToolDlg,IDC_ICONTYPECOMBO);
 
 	//例: "32*32 (xxxx色)"
@@ -182,10 +182,10 @@
 	//再描画
 	HBRUSH hOldBrush;
-	hOldBrush=(HBRUSH)SelectObject(MdiInfo[WndNum].MdiIconEditInfo->memdc,GetStockObject(WHITE_BRUSH));
-	PatBlt(MdiInfo[WndNum].MdiIconEditInfo->memdc,0,0,400,400,PATCOPY);
-	SelectObject(MdiInfo[WndNum].MdiIconEditInfo->memdc,hOldBrush);
+	hOldBrush=(HBRUSH)SelectObject(MdiInfo[WndNum]->MdiIconEditInfo->memdc,GetStockObject(WHITE_BRUSH));
+	PatBlt(MdiInfo[WndNum]->MdiIconEditInfo->memdc,0,0,400,400,PATCOPY);
+	SelectObject(MdiInfo[WndNum]->MdiIconEditInfo->memdc,hOldBrush);
 	DrawIconToMemBmp(WndNum,0);
-	InvalidateRect(MdiInfo[WndNum].MdiIconEditInfo->hMain,NULL,1);
-	InvalidateRect(MdiInfo[WndNum].MdiIconEditInfo->hColorDlg,NULL,0);
+	InvalidateRect(MdiInfo[WndNum]->MdiIconEditInfo->hMain,NULL,1);
+	InvalidateRect(MdiInfo[WndNum]->MdiIconEditInfo->hColorDlg,NULL,0);
 }
 void DeleteIconType(int WndNum){
@@ -194,43 +194,43 @@
 	//変更情報を解放
 	for(i=0;i<MAX_ICONEDIT_UNDONUM;i++){
-		if(MdiInfo[WndNum].MdiIconEditInfo->undo[MdiInfo[WndNum].MdiIconEditInfo->SelectIconNum].lpData[i])
-			HeapDefaultFree(MdiInfo[WndNum].MdiIconEditInfo->undo[MdiInfo[WndNum].MdiIconEditInfo->SelectIconNum].lpData[i]);
+		if(MdiInfo[WndNum]->MdiIconEditInfo->undo[MdiInfo[WndNum]->MdiIconEditInfo->SelectIconNum].lpData[i])
+			HeapDefaultFree(MdiInfo[WndNum]->MdiIconEditInfo->undo[MdiInfo[WndNum]->MdiIconEditInfo->SelectIconNum].lpData[i]);
 	}
 
 	//メモリを解放
-	HeapDefaultFree(MdiInfo[WndNum].MdiIconEditInfo->pIconImage[MdiInfo[WndNum].MdiIconEditInfo->SelectIconNum]);
+	HeapDefaultFree(MdiInfo[WndNum]->MdiIconEditInfo->pIconImage[MdiInfo[WndNum]->MdiIconEditInfo->SelectIconNum]);
 
 	//イメージ選択用のメモリを解放
-	if(MdiInfo[WndNum].MdiIconEditInfo->SelectLevel==2)
-		DeleteObject(MdiInfo[WndNum].MdiIconEditInfo->hSelectingBmp);
-	MdiInfo[WndNum].MdiIconEditInfo->SelectLevel=0;
+	if(MdiInfo[WndNum]->MdiIconEditInfo->SelectLevel==2)
+		DeleteObject(MdiInfo[WndNum]->MdiIconEditInfo->hSelectingBmp);
+	MdiInfo[WndNum]->MdiIconEditInfo->SelectLevel=0;
 
 	////////////////////////
 	// アイコンタイプを削除
-	for(i=MdiInfo[WndNum].MdiIconEditInfo->SelectIconNum;i<MdiInfo[WndNum].MdiIconEditInfo->num-1;i++){
-		MdiInfo[WndNum].MdiIconEditInfo->pIconImage[i]=MdiInfo[WndNum].MdiIconEditInfo->pIconImage[i+1];
-		MdiInfo[WndNum].MdiIconEditInfo->dwBytesInRes[i]=MdiInfo[WndNum].MdiIconEditInfo->dwBytesInRes[i+1];
-		MdiInfo[WndNum].MdiIconEditInfo->undo[i]=MdiInfo[WndNum].MdiIconEditInfo->undo[i+1];
-	}
-	MdiInfo[WndNum].MdiIconEditInfo->num--;
-	if(MdiInfo[WndNum].MdiIconEditInfo->num==MdiInfo[WndNum].MdiIconEditInfo->SelectIconNum)
-		MdiInfo[WndNum].MdiIconEditInfo->SelectIconNum=MdiInfo[WndNum].MdiIconEditInfo->num-1;
+	for(i=MdiInfo[WndNum]->MdiIconEditInfo->SelectIconNum;i<MdiInfo[WndNum]->MdiIconEditInfo->num-1;i++){
+		MdiInfo[WndNum]->MdiIconEditInfo->pIconImage[i]=MdiInfo[WndNum]->MdiIconEditInfo->pIconImage[i+1];
+		MdiInfo[WndNum]->MdiIconEditInfo->dwBytesInRes[i]=MdiInfo[WndNum]->MdiIconEditInfo->dwBytesInRes[i+1];
+		MdiInfo[WndNum]->MdiIconEditInfo->undo[i]=MdiInfo[WndNum]->MdiIconEditInfo->undo[i+1];
+	}
+	MdiInfo[WndNum]->MdiIconEditInfo->num--;
+	if(MdiInfo[WndNum]->MdiIconEditInfo->num==MdiInfo[WndNum]->MdiIconEditInfo->SelectIconNum)
+		MdiInfo[WndNum]->MdiIconEditInfo->SelectIconNum=MdiInfo[WndNum]->MdiIconEditInfo->num-1;
 
 	//コンボボックスからアイコンタイプを削除
 	HWND hCombo;
-	hCombo=GetDlgItem(MdiInfo[WndNum].MdiIconEditInfo->hToolDlg,IDC_ICONTYPECOMBO);
+	hCombo=GetDlgItem(MdiInfo[WndNum]->MdiIconEditInfo->hToolDlg,IDC_ICONTYPECOMBO);
 	i=SendMessage(hCombo,CB_DELETESTRING,
 		SendMessage(hCombo,CB_GETCURSEL,0,0),
 		0);
-	SendMessage(hCombo,CB_SETCURSEL,MdiInfo[WndNum].MdiIconEditInfo->SelectIconNum,0);
+	SendMessage(hCombo,CB_SETCURSEL,MdiInfo[WndNum]->MdiIconEditInfo->SelectIconNum,0);
 
 	//再描画
 	HBRUSH hOldBrush;
-	hOldBrush=(HBRUSH)SelectObject(MdiInfo[WndNum].MdiIconEditInfo->memdc,GetStockObject(WHITE_BRUSH));
-	PatBlt(MdiInfo[WndNum].MdiIconEditInfo->memdc,0,0,400,400,PATCOPY);
-	SelectObject(MdiInfo[WndNum].MdiIconEditInfo->memdc,hOldBrush);
+	hOldBrush=(HBRUSH)SelectObject(MdiInfo[WndNum]->MdiIconEditInfo->memdc,GetStockObject(WHITE_BRUSH));
+	PatBlt(MdiInfo[WndNum]->MdiIconEditInfo->memdc,0,0,400,400,PATCOPY);
+	SelectObject(MdiInfo[WndNum]->MdiIconEditInfo->memdc,hOldBrush);
 	DrawIconToMemBmp(WndNum,0);
-	InvalidateRect(MdiInfo[WndNum].MdiIconEditInfo->hMain,NULL,1);
-	InvalidateRect(MdiInfo[WndNum].MdiIconEditInfo->hColorDlg,NULL,0);
+	InvalidateRect(MdiInfo[WndNum]->MdiIconEditInfo->hMain,NULL,1);
+	InvalidateRect(MdiInfo[WndNum]->MdiIconEditInfo->hColorDlg,NULL,0);
 }
 void NewIconEditWindow(const char *filepath){
@@ -252,6 +252,6 @@
 		while(hChild){
 			i=GetWndNum(hChild);
-			if(MdiInfo[i].DocType==WNDTYPE_ICONEDIT){
-				if(lstrcmpi(MdiInfo[i].path.c_str(),filepath)==0) break;
+			if(MdiInfo[i]->DocType==WNDTYPE_ICONEDIT){
+				if(lstrcmpi(MdiInfo[i]->path.c_str(),filepath)==0) break;
 			}
 			hChild=GetNextWindow(hChild,GW_HWNDNEXT);
@@ -344,4 +344,5 @@
 
 	mdic.lParam=0;
+	mdic.style |= WS_VISIBLE | WS_CHILD | WS_CLIPSIBLINGS | WS_CLIPCHILDREN | WS_SYSMENU | WS_CAPTION | WS_THICKFRAME | WS_MINIMIZEBOX | WS_MAXIMIZEBOX;
 	hChild=(HWND)SendMessage(hClient,WM_MDICREATE,0,(long)&mdic);	//ウィンドウ作成
 
@@ -369,47 +370,47 @@
 
 	//ウィンドウのID登録
-	MdiInfo.push_back( MDIINFO() );
+	MdiInfo.push_back( new MDIINFO() );
 	i = MdiInfo.size()-1;
-	MdiInfo[i].hwnd=hChild;
-	MdiInfo[i].DocType=WNDTYPE_ICONEDIT;
-	MdiInfo[i].title = str;
+	MdiInfo[i]->hwnd=hChild;
+	MdiInfo[i]->DocType=WNDTYPE_ICONEDIT;
+	MdiInfo[i]->title = str;
 	if(filepath)
 	{
-		MdiInfo[i].path = filepath;
+		MdiInfo[i]->path = filepath;
 	}
 	else
 	{
-		MdiInfo[i].path = "";
-	}
-
-	MdiInfo[i].MdiIconEditInfo=(MDIICONEDITINFO *)HeapAlloc(hHeap,0,sizeof(MDIICONEDITINFO));
-	MdiInfo[i].MdiIconEditInfo->hMain=hMain;
-	MdiInfo[i].MdiIconEditInfo->hToolDlg=hToolDlg;
-	MdiInfo[i].MdiIconEditInfo->hButtonsDlg=hButtonsDlg;
-	MdiInfo[i].MdiIconEditInfo->hColorDlg=hColorDlg;
+		MdiInfo[i]->path = "";
+	}
+
+	MdiInfo[i]->MdiIconEditInfo=(MDIICONEDITINFO *)HeapAlloc(hHeap,0,sizeof(MDIICONEDITINFO));
+	MdiInfo[i]->MdiIconEditInfo->hMain=hMain;
+	MdiInfo[i]->MdiIconEditInfo->hToolDlg=hToolDlg;
+	MdiInfo[i]->MdiIconEditInfo->hButtonsDlg=hButtonsDlg;
+	MdiInfo[i]->MdiIconEditInfo->hColorDlg=hColorDlg;
 	hdc=GetDC(hMain);
-	MdiInfo[i].MdiIconEditInfo->memdc=CreateCompatibleDC(hdc);
-	MdiInfo[i].MdiIconEditInfo->hMemBmp=CreateCompatibleBitmap(hdc,600,400);
-	SelectObject(MdiInfo[i].MdiIconEditInfo->memdc,MdiInfo[i].MdiIconEditInfo->hMemBmp);
+	MdiInfo[i]->MdiIconEditInfo->memdc=CreateCompatibleDC(hdc);
+	MdiInfo[i]->MdiIconEditInfo->hMemBmp=CreateCompatibleBitmap(hdc,600,400);
+	SelectObject(MdiInfo[i]->MdiIconEditInfo->memdc,MdiInfo[i]->MdiIconEditInfo->hMemBmp);
 	ReleaseDC(hMain,hdc);
 
-	MdiInfo[i].MdiIconEditInfo->SelectLevel=0;
-
-	MdiInfo[i].MdiIconEditInfo->num=IconNum;
-	MdiInfo[i].MdiIconEditInfo->SelectIconNum=0;
-	memcpy(MdiInfo[i].MdiIconEditInfo->pIconImage,pImageBuffer,sizeof(DWORD)*IconNum);
-
-	memcpy(MdiInfo[i].MdiIconEditInfo->dwBytesInRes,dwBytesInRes,sizeof(DWORD)*IconNum);
-
-	MdiInfo[i].MdiIconEditInfo->NowTool=IDC_TOOL_PEN;
-	MdiInfo[i].MdiIconEditInfo->MainColor=RGB(0,0,0);
+	MdiInfo[i]->MdiIconEditInfo->SelectLevel=0;
+
+	MdiInfo[i]->MdiIconEditInfo->num=IconNum;
+	MdiInfo[i]->MdiIconEditInfo->SelectIconNum=0;
+	memcpy(MdiInfo[i]->MdiIconEditInfo->pIconImage,pImageBuffer,sizeof(DWORD)*IconNum);
+
+	memcpy(MdiInfo[i]->MdiIconEditInfo->dwBytesInRes,dwBytesInRes,sizeof(DWORD)*IconNum);
+
+	MdiInfo[i]->MdiIconEditInfo->NowTool=IDC_TOOL_PEN;
+	MdiInfo[i]->MdiIconEditInfo->MainColor=RGB(0,0,0);
 	extern COLORREF TransparentClrRef;
-	MdiInfo[i].MdiIconEditInfo->SubColor=TransparentClrRef;
-
-	for(i2=0;i2<MdiInfo[i].MdiIconEditInfo->num;i2++){
-		MdiInfo[i].MdiIconEditInfo->undo[i2].NowPos=0;
-		memset(MdiInfo[i].MdiIconEditInfo->undo[i2].lpData,0,sizeof(BYTE *)*MAX_ICONEDIT_UNDONUM);
-	}
-	MdiInfo[i].MdiIconEditInfo->bModify=0;
+	MdiInfo[i]->MdiIconEditInfo->SubColor=TransparentClrRef;
+
+	for(i2=0;i2<MdiInfo[i]->MdiIconEditInfo->num;i2++){
+		MdiInfo[i]->MdiIconEditInfo->undo[i2].NowPos=0;
+		memset(MdiInfo[i]->MdiIconEditInfo->undo[i2].lpData,0,sizeof(BYTE *)*MAX_ICONEDIT_UNDONUM);
+	}
+	MdiInfo[i]->MdiIconEditInfo->bModify=0;
 
 
@@ -417,7 +418,7 @@
 	//メモリへ初期描画を行う
 	HBRUSH hOldBrush;
-	hOldBrush=(HBRUSH)SelectObject(MdiInfo[i].MdiIconEditInfo->memdc,GetStockObject(WHITE_BRUSH));
-	PatBlt(MdiInfo[i].MdiIconEditInfo->memdc,0,0,600,400,PATCOPY);
-	SelectObject(MdiInfo[i].MdiIconEditInfo->memdc,hOldBrush);
+	hOldBrush=(HBRUSH)SelectObject(MdiInfo[i]->MdiIconEditInfo->memdc,GetStockObject(WHITE_BRUSH));
+	PatBlt(MdiInfo[i]->MdiIconEditInfo->memdc,0,0,600,400,PATCOPY);
+	SelectObject(MdiInfo[i]->MdiIconEditInfo->memdc,hOldBrush);
 	DrawIconToMemBmp(i,0);
 
@@ -430,5 +431,5 @@
 	ResetIconType(i);
 
-	if(MdiInfo[i].MdiIconEditInfo->num<=1)
+	if(MdiInfo[i]->MdiIconEditInfo->num<=1)
 		EnableWindow(GetDlgItem(hToolDlg,IDC_DELETE_ICONTYPE),0);
 
@@ -460,5 +461,5 @@
 	*((WORD *)(buffer+i2))=1;	//idType
 	i2+=sizeof(WORD);
-	*((WORD *)(buffer+i2))=MdiInfo[WndNum].MdiIconEditInfo->num;	//idCount
+	*((WORD *)(buffer+i2))=MdiInfo[WndNum]->MdiIconEditInfo->num;	//idCount
 	i2+=sizeof(WORD);
 
@@ -470,9 +471,9 @@
 	//イメージバッファの初期位置
 	IconDirEntry.dwImageOffset=sizeof(ICONDIR)+
-		sizeof(ICONDIRENTRY)*MdiInfo[WndNum].MdiIconEditInfo->num;
-
-	for(i=0;i<MdiInfo[WndNum].MdiIconEditInfo->num;i++){
+		sizeof(ICONDIRENTRY)*MdiInfo[WndNum]->MdiIconEditInfo->num;
+
+	for(i=0;i<MdiInfo[WndNum]->MdiIconEditInfo->num;i++){
 		BITMAPINFOHEADER *pBmpInfoHdr;
-		pBmpInfoHdr=(BITMAPINFOHEADER *)MdiInfo[WndNum].MdiIconEditInfo->pIconImage[i];
+		pBmpInfoHdr=(BITMAPINFOHEADER *)MdiInfo[WndNum]->MdiIconEditInfo->pIconImage[i];
 
 		IconDirEntry.bWidth=(BYTE)pBmpInfoHdr->biWidth;
@@ -505,7 +506,7 @@
 	////////////////////
 	// イメージバッファ
-	for(i=0;i<MdiInfo[WndNum].MdiIconEditInfo->num;i++){
+	for(i=0;i<MdiInfo[WndNum]->MdiIconEditInfo->num;i++){
 		memcpy(buffer+i2,
-			MdiInfo[WndNum].MdiIconEditInfo->pIconImage[i],
+			MdiInfo[WndNum]->MdiIconEditInfo->pIconImage[i],
 			ImgBufSize[i]);
 
@@ -538,5 +539,5 @@
 			if(i==-1) return 0;	//ウィンドウが初期状態の場合
 
-			i=SendMessage(hDocCombo,CB_FINDSTRINGEXACT,0,(long)MdiInfo[i].title.c_str());
+			i=SendMessage(hDocCombo,CB_FINDSTRINGEXACT,0,(long)MdiInfo[i]->title.c_str());
 			SendMessage(hDocCombo,CB_SETCURSEL,i,0);
 			SetStatusText(NULL);
@@ -546,7 +547,7 @@
 			WndNum=GetWndNum(hwnd);
 			if(WndNum==-1) break;
-			ResizeIconWindow(MdiInfo[WndNum].MdiIconEditInfo->hMain,
-				MdiInfo[WndNum].MdiIconEditInfo->hToolDlg,
-				MdiInfo[WndNum].MdiIconEditInfo->hColorDlg,
+			ResizeIconWindow(MdiInfo[WndNum]->MdiIconEditInfo->hMain,
+				MdiInfo[WndNum]->MdiIconEditInfo->hToolDlg,
+				MdiInfo[WndNum]->MdiIconEditInfo->hColorDlg,
 				LOWORD(lParam),HIWORD(lParam));
 			break;
