Index: trunk/ab5.0/abdev/abdev/src/MainFrame.cpp
===================================================================
--- trunk/ab5.0/abdev/abdev/src/MainFrame.cpp	(revision 500)
+++ trunk/ab5.0/abdev/abdev/src/MainFrame.cpp	(revision 501)
@@ -7,4 +7,14 @@
 void SetupWindow(HWND hwnd);
 void ResetTextEditFont(HWND hwnd);
+
+void MainFrame::OpenWebBrowser( const std::string &url )
+{
+	ShellExecute(m_hWnd,"open",url.c_str(),"",NULL,SW_SHOWNORMAL);
+}
+
+void MainFrame::OpenExplorer( const std::string &path )
+{
+	ShellExecute(m_hWnd,"explore",path.c_str(),NULL,NULL,SW_SHOWNORMAL);
+}
 
 ::LRESULT MainFrame::OnCreate( ::UINT msg, ::WPARAM wParam, ::LPARAM lParam, ::BOOL& handled )
@@ -51,10 +61,87 @@
 }
 
-::LRESULT MainFrame::OnClose( ::UINT msg, ::WPARAM wParam, ::LPARAM lParam, ::BOOL& handled )
-{
+BOOL MainFrame::OnQueryEndSession(UINT nSource, UINT uLogOff)
+{
+	OnClose();
+
+	return TRUE;
+}
+
+void MainFrame::OnClose()
+{
+	extern BOOL bSearchingClasses;
+	if(bSearchingClasses){
+		pobj_ClassTreeView->bCloseSwitch=1;
+		return;
+	}
+
+	//コンパイラビューを閉じる
+	extern HWND hCompileView;
+	if(hCompileView)
+		SendMessage(hCompileView,WM_COMMAND,IDCANCEL,0);
+
+	//次回起動時にMDIウィンドウを最大化させるかを判定
+	HWND hChild=::GetWindow(hClient,GW_CHILD);
+	pobj_nv->bMDIZoomed=::IsZoomed(hChild);
+
+	//プロジェクトを閉じる
+	if(ProjectInfo.name[0]){
+		if(!CloseProject()) return;
+	}
+
+	//MDIウィンドウの保存確認
+	hChild=::GetWindow(hClient,GW_CHILD);
+	while(hChild){
+		if(!DocumentModifyCheck(hChild)) return;
+		hChild=::GetNextWindow(hChild,GW_HWNDNEXT);
+	}
+
+
+	KillTimer(ID_TIMER_BACKUP);
+
+
+	//ProjectViewの位置を保存、ProjectViewを破棄
+	extern HWND hProjectView;
+	extern HWND hProjectView_ToolWindow;
+	::GetWindowRect(hProjectView_ToolWindow,&pobj_nv->rectProjectView);
+	::DestroyWindow(hProjectView);
+	::DestroyWindow(hProjectView_ToolWindow);
+
+	//Rebarの位置を保存、Rebarを破棄
+	delete pobj_Rebar;
+	pobj_Rebar=0;
+
+	//タブコントロールを破棄
+	delete pobj_MainTab;
+	pobj_MainTab=0;
+
+	//SideWebを破棄
+	delete pobj_SideWeb;
+	pobj_SideWeb=0;
+
+	//メインウィンドウの最大化有無、座標を保存
+	if(IsZoomed()) pobj_nv->bWindowMax=1;
+	else if(!IsIconic()){
+		pobj_nv->bWindowMax=0;
+		GetWindowRect(&pobj_nv->StartupWindowRect);
+	}
+
+	hChild=::GetWindow(hClient,GW_CHILD);
+	while(hChild){
+		CloseDocWindow(GetWndNum(hChild));
+		::DestroyWindow(hChild);
+		hChild=::GetWindow(hClient,GW_CHILD);
+	}
+
+	EndProjectEditor();		//ProjectEditorの情報を保存
+
+	//エディタ用フォントを破棄
+	extern HFONT hFont_TextEdit,hFont_HyperLink_TextEdit;
+	if(hFont_TextEdit) DeleteObject(hFont_TextEdit);
+	if(hFont_HyperLink_TextEdit) DeleteObject(hFont_HyperLink_TextEdit);
+
 	DestroyWindow();
-	return 0;
-}
-::LRESULT MainFrame::OnDestroy( ::UINT msg, ::WPARAM wParam, ::LPARAM lParam, ::BOOL& handled )
+}
+void MainFrame::OnDestroy()
 {
 	mdiWindow->DestroyWindow();
@@ -62,6 +149,4 @@
 
 	::PostQuitMessage( 0 );
-
-	return 0;
 }
 
@@ -766,4 +851,5 @@
 }
 
+#ifndef THETEXT
 void MainFrame::OnCmdDebug( UINT uNotifyCode, int nID, CWindow wndCtl )
 {
@@ -1052,2 +1138,230 @@
 	ShellExecute(m_hWnd,"open",temporary,NULL,NULL,SW_SHOWNORMAL);
 }
+
+void MainFrame::OnCmdStepIn( UINT uNotifyCode, int nID, CWindow wndCtl )
+{
+	pobj_Debugger->StepIn();
+}
+
+void MainFrame::OnCmdStepOver( UINT uNotifyCode, int nID, CWindow wndCtl )
+{
+	pobj_Debugger->StepOver();
+}
+
+void MainFrame::OnCmdStepCursor( UINT uNotifyCode, int nID, CWindow wndCtl )
+{
+	pobj_Debugger->StepToCursor();
+}
+
+void MainFrame::OnCmdBreakPoint( UINT uNotifyCode, int nID, CWindow wndCtl )
+{
+	if(ProjectInfo.name[0]){
+		ProjectInfo.pobj_DBBreakPoint->Event_BreakPoint();
+	}
+	else{
+		extern CDBBreakPoint *pobj_DBBreakPoint;
+		pobj_DBBreakPoint->Event_BreakPoint();
+	}
+}
+
+void MainFrame::OnCmdDebugStop( UINT uNotifyCode, int nID, CWindow wndCtl )
+{
+	pobj_Debugger->DebugStop();
+}
+
+void MainFrame::OnCmdDebugPause( UINT uNotifyCode, int nID, CWindow wndCtl )
+{
+	pobj_Debugger->DebugPause();
+}
+
+#endif	// not THETEXT
+
+void MainFrame::OnCmdWebLink( UINT uNotifyCode, int nID, CWindow wndCtl )
+{
+	switch( nID )
+	{
+#ifndef THETEXT
+	case IDM_COMMUNITY:
+		OpenWebBrowser( "http://www.activebasic.com/forum/" );
+		break;
+	case IDM_COMMU_SEARCH:
+		OpenWebBrowser( "http://www.activebasic.com/forum/search.php" );
+		break;
+	case IDM_COMMU_PM:
+		OpenWebBrowser( "http://www.activebasic.com/forum/privmsg.php?folder=inbox" );
+		break;
+	case ID_COMMU_FORUM1:
+		OpenWebBrowser( "http://www.activebasic.com/forum/viewforum.php?f=1" );
+		break;
+	case ID_COMMU_FORUM2:
+		OpenWebBrowser( "http://www.activebasic.com/forum/viewforum.php?f=2" );
+		break;
+	case ID_COMMU_FORUM3:
+		OpenWebBrowser( "http://www.activebasic.com/forum/viewforum.php?f=5" );
+		break;
+	case ID_COMMU_FORUM4:
+		OpenWebBrowser( "http://www.activebasic.com/forum/viewforum.php?f=3" );
+		break;
+	case ID_COMMU_FORUM5:
+		OpenWebBrowser( "http://www.activebasic.com/forum/viewforum.php?f=6" );
+		break;
+	case ID_COMMU_FORUM6:
+		OpenWebBrowser( "http://www.activebasic.com/forum/viewforum.php?f=8" );
+		break;
+	case ID_COMMU_FORUM7:
+		OpenWebBrowser( "http://www.activebasic.com/forum/viewforum.php?f=4" );
+		break;
+	case ID_COMMU_FORUM8:
+		OpenWebBrowser( "http://www.activebasic.com/forum/viewforum.php?f=7" );
+		break;
+	case IDM_AB_WEBSITE:
+		OpenWebBrowser( "http://www.activebasic.com/" );
+		break;
+	case IDM_ACTBDL:
+		OpenWebBrowser( "http://www.activebasic.com/activebasic5/download.htm" );
+		break;
+#else
+	case IDM_DSHOMEPAGE:
+		OpenWebBrowser( "http://www.discoversoft.net/" );
+		break;
+#endif // not THETEXT
+	default:
+		throw;
+	}
+}
+
+void MainFrame::OnCmdTopics( UINT uNotifyCode, int nID, CWindow wndCtl )
+{
+	char temporary[1024];
+#ifdef THETEXT
+	sprintf(temporary,"%sTopics\\index.html",pj_editor_Dir);
+	ShellExecute(m_hWnd,"open",temporary,NULL,NULL,SW_SHOWNORMAL);
+#else
+	sprintf(temporary,"%sBasicHelp.chm",pj_editor_Dir);
+	HtmlHelp(NULL,temporary,HH_DISPLAY_TOPIC,0);
+#endif
+}
+
+void MainFrame::OnCmdAbout( UINT uNotifyCode, int nID, CWindow wndCtl )
+{
+	DialogBox(hResInst,MAKEINTRESOURCE(IDD_ABOUT),m_hWnd,(DLGPROC)DialogAbout);
+}
+
+void MainFrame::OnCmdDocSelectBand( UINT uNotifyCode, int nID, CWindow wndCtl )
+{
+	pobj_Rebar->ChangeRebarBand(ID_DOCCOMBO);
+}
+
+void MainFrame::OnCmdStandardBand( UINT uNotifyCode, int nID, CWindow wndCtl )
+{
+	pobj_Rebar->ChangeRebarBand(ID_STANDARDTOOLBAR);
+}
+
+void MainFrame::OnCmdReleaseBand( UINT uNotifyCode, int nID, CWindow wndCtl )
+{
+	pobj_Rebar->ChangeRebarBand(ID_RELEASETOOLBAR);
+}
+
+void MainFrame::OnCmdDebugBand( UINT uNotifyCode, int nID, CWindow wndCtl )
+{
+	pobj_Rebar->ChangeRebarBand(ID_DEBUGGERTOOLBAR);
+}
+
+void MainFrame::OnCmdSelectCompilerBand( UINT uNotifyCode, int nID, CWindow wndCtl )
+{
+	pobj_Rebar->ChangeRebarBand(ID_SELECTCOMPILERCOMBO);
+}
+
+void MainFrame::OnCmdNoGripper( UINT uNotifyCode, int nID, CWindow wndCtl )
+{
+	if(pobj_nv->bNoGripper) pobj_nv->bNoGripper=0;
+	else pobj_nv->bNoGripper=1;
+
+	//レバーコントロールを再生成
+	pobj_Rebar->ResetRebar();
+
+	//メニュー状態を設定
+	ResetState_DocMenu();
+}
+
+void MainFrame::OnCmdResetRebar( UINT uNotifyCode, int nID, CWindow wndCtl )
+{
+	//"ツールバーの配置をすべて初期状態に戻します。\nよろしいですか？"
+	if( MessageBox(STRING_TOOLBAR_RESET,APPLICATION_NAME,MB_OKCANCEL|MB_ICONEXCLAMATION) == IDCANCEL )
+	{
+		return;
+	}
+
+	//レバーコントロールを再生成
+	pobj_Rebar->ResetInitRebar();
+
+	//メニュー状態を設定
+	ResetState_DocMenu();
+}
+
+void MainFrame::OnCmdAllCloseOmitMyself( UINT uNotifyCode, int nID, CWindow wndCtl )
+{
+	//このウィンドウ以外をすべて閉じる(&A)
+	HWND hChild=::GetWindow(hClient,GW_CHILD);
+	int WndNum=GetWndNum(hChild);
+	for(int i=0;i<MAX_WNDNUM;i++){
+		if(i==WndNum) continue;
+		if(MdiInfo[i].hwnd) SendMessage(MdiInfo[i].hwnd,WM_CLOSE,0,0);
+	}
+}
+
+void MainFrame::OnCmdPathCopy( UINT uNotifyCode, int nID, CWindow wndCtl )
+{
+	HWND hChild=::GetWindow(hClient,GW_CHILD);
+	int WndNum=GetWndNum(hChild);
+
+	//絶対パスをコピー
+	HGLOBAL hGlobal=(char *)GlobalAlloc(GMEM_MOVEABLE,lstrlen(MdiInfo[WndNum].path)+1);
+	char *pTemp=(char *)GlobalLock(hGlobal);
+	lstrcpy(pTemp,MdiInfo[WndNum].path);
+	GlobalUnlock(hGlobal);
+
+	//クリップボードに保存
+	OpenClipboard();
+	EmptyClipboard();
+	SetClipboardData(CF_TEXT,hGlobal);
+	CloseClipboard();
+}
+
+void MainFrame::OnCmdFolderOpen( UINT uNotifyCode, int nID, CWindow wndCtl )
+{
+	HWND hChild=::GetWindow(hClient,GW_CHILD);
+	int WndNum=GetWndNum(hChild);
+
+	char temporary[1024], temp2[1024];
+	_splitpath(MdiInfo[WndNum].path,temporary,temp2,NULL,NULL);
+	lstrcat(temporary,temp2);
+
+	OpenExplorer( temporary );
+}
+
+void MainFrame::OnCmdDeleteFile( UINT uNotifyCode, int nID, CWindow wndCtl )
+{
+	HWND hChild=::GetWindow(hClient,GW_CHILD);
+	int WndNum=GetWndNum(hChild);
+
+	char temporary[1024], temp2[1024];
+	_splitpath(MdiInfo[WndNum].path,NULL,NULL,temporary,temp2);
+	lstrcat(temporary,temp2);
+
+	lstrcat(temporary," をごみ箱に移動して閉じます。よろしいですか？");
+	if(MessageBox(temporary,APPLICATION_NAME,MB_OKCANCEL|MB_ICONQUESTION)==IDCANCEL) return;
+
+	//ゴミ箱へ
+	SHFILEOPSTRUCT fo;
+	fo.hwnd=m_hWnd;
+	fo.wFunc=FO_DELETE;
+	fo.pFrom =MdiInfo[WndNum].path;
+	fo.pTo="\0";
+	fo.fFlags =FOF_ALLOWUNDO|FOF_NOCONFIRMATION;
+	SHFileOperation(&fo);
+
+	//閉じる
+	MdiInfo[WndNum].pMdiTextEdit->UnModify();
+	SendMessage(MdiInfo[WndNum].hwnd,WM_CLOSE,0,0);
+}
