Changeset 501 in dev for trunk/ab5.0/abdev/abdev/src


Ignore:
Timestamp:
Apr 24, 2008, 1:03:58 PM (16 years ago)
Author:
dai_9181
Message:

いくつかのメニューをMainFrameに実装しなおした

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/ab5.0/abdev/abdev/src/MainFrame.cpp

    r500 r501  
    77void SetupWindow(HWND hwnd);
    88void ResetTextEditFont(HWND hwnd);
     9
     10void MainFrame::OpenWebBrowser( const std::string &url )
     11{
     12    ShellExecute(m_hWnd,"open",url.c_str(),"",NULL,SW_SHOWNORMAL);
     13}
     14
     15void MainFrame::OpenExplorer( const std::string &path )
     16{
     17    ShellExecute(m_hWnd,"explore",path.c_str(),NULL,NULL,SW_SHOWNORMAL);
     18}
    919
    1020::LRESULT MainFrame::OnCreate( ::UINT msg, ::WPARAM wParam, ::LPARAM lParam, ::BOOL& handled )
     
    5161}
    5262
    53 ::LRESULT MainFrame::OnClose( ::UINT msg, ::WPARAM wParam, ::LPARAM lParam, ::BOOL& handled )
    54 {
     63BOOL MainFrame::OnQueryEndSession(UINT nSource, UINT uLogOff)
     64{
     65    OnClose();
     66
     67    return TRUE;
     68}
     69
     70void MainFrame::OnClose()
     71{
     72    extern BOOL bSearchingClasses;
     73    if(bSearchingClasses){
     74        pobj_ClassTreeView->bCloseSwitch=1;
     75        return;
     76    }
     77
     78    //コンパイラビューを閉じる
     79    extern HWND hCompileView;
     80    if(hCompileView)
     81        SendMessage(hCompileView,WM_COMMAND,IDCANCEL,0);
     82
     83    //次回起動時にMDIウィンドウを最大化させるかを判定
     84    HWND hChild=::GetWindow(hClient,GW_CHILD);
     85    pobj_nv->bMDIZoomed=::IsZoomed(hChild);
     86
     87    //プロジェクトを閉じる
     88    if(ProjectInfo.name[0]){
     89        if(!CloseProject()) return;
     90    }
     91
     92    //MDIウィンドウの保存確認
     93    hChild=::GetWindow(hClient,GW_CHILD);
     94    while(hChild){
     95        if(!DocumentModifyCheck(hChild)) return;
     96        hChild=::GetNextWindow(hChild,GW_HWNDNEXT);
     97    }
     98
     99
     100    KillTimer(ID_TIMER_BACKUP);
     101
     102
     103    //ProjectViewの位置を保存、ProjectViewを破棄
     104    extern HWND hProjectView;
     105    extern HWND hProjectView_ToolWindow;
     106    ::GetWindowRect(hProjectView_ToolWindow,&pobj_nv->rectProjectView);
     107    ::DestroyWindow(hProjectView);
     108    ::DestroyWindow(hProjectView_ToolWindow);
     109
     110    //Rebarの位置を保存、Rebarを破棄
     111    delete pobj_Rebar;
     112    pobj_Rebar=0;
     113
     114    //タブコントロールを破棄
     115    delete pobj_MainTab;
     116    pobj_MainTab=0;
     117
     118    //SideWebを破棄
     119    delete pobj_SideWeb;
     120    pobj_SideWeb=0;
     121
     122    //メインウィンドウの最大化有無、座標を保存
     123    if(IsZoomed()) pobj_nv->bWindowMax=1;
     124    else if(!IsIconic()){
     125        pobj_nv->bWindowMax=0;
     126        GetWindowRect(&pobj_nv->StartupWindowRect);
     127    }
     128
     129    hChild=::GetWindow(hClient,GW_CHILD);
     130    while(hChild){
     131        CloseDocWindow(GetWndNum(hChild));
     132        ::DestroyWindow(hChild);
     133        hChild=::GetWindow(hClient,GW_CHILD);
     134    }
     135
     136    EndProjectEditor();     //ProjectEditorの情報を保存
     137
     138    //エディタ用フォントを破棄
     139    extern HFONT hFont_TextEdit,hFont_HyperLink_TextEdit;
     140    if(hFont_TextEdit) DeleteObject(hFont_TextEdit);
     141    if(hFont_HyperLink_TextEdit) DeleteObject(hFont_HyperLink_TextEdit);
     142
    55143    DestroyWindow();
    56     return 0;
    57 }
    58 ::LRESULT MainFrame::OnDestroy( ::UINT msg, ::WPARAM wParam, ::LPARAM lParam, ::BOOL& handled )
     144}
     145void MainFrame::OnDestroy()
    59146{
    60147    mdiWindow->DestroyWindow();
     
    62149
    63150    ::PostQuitMessage( 0 );
    64 
    65     return 0;
    66151}
    67152
     
    766851}
    767852
     853#ifndef THETEXT
    768854void MainFrame::OnCmdDebug( UINT uNotifyCode, int nID, CWindow wndCtl )
    769855{
     
    10521138    ShellExecute(m_hWnd,"open",temporary,NULL,NULL,SW_SHOWNORMAL);
    10531139}
     1140
     1141void MainFrame::OnCmdStepIn( UINT uNotifyCode, int nID, CWindow wndCtl )
     1142{
     1143    pobj_Debugger->StepIn();
     1144}
     1145
     1146void MainFrame::OnCmdStepOver( UINT uNotifyCode, int nID, CWindow wndCtl )
     1147{
     1148    pobj_Debugger->StepOver();
     1149}
     1150
     1151void MainFrame::OnCmdStepCursor( UINT uNotifyCode, int nID, CWindow wndCtl )
     1152{
     1153    pobj_Debugger->StepToCursor();
     1154}
     1155
     1156void MainFrame::OnCmdBreakPoint( UINT uNotifyCode, int nID, CWindow wndCtl )
     1157{
     1158    if(ProjectInfo.name[0]){
     1159        ProjectInfo.pobj_DBBreakPoint->Event_BreakPoint();
     1160    }
     1161    else{
     1162        extern CDBBreakPoint *pobj_DBBreakPoint;
     1163        pobj_DBBreakPoint->Event_BreakPoint();
     1164    }
     1165}
     1166
     1167void MainFrame::OnCmdDebugStop( UINT uNotifyCode, int nID, CWindow wndCtl )
     1168{
     1169    pobj_Debugger->DebugStop();
     1170}
     1171
     1172void MainFrame::OnCmdDebugPause( UINT uNotifyCode, int nID, CWindow wndCtl )
     1173{
     1174    pobj_Debugger->DebugPause();
     1175}
     1176
     1177#endif  // not THETEXT
     1178
     1179void MainFrame::OnCmdWebLink( UINT uNotifyCode, int nID, CWindow wndCtl )
     1180{
     1181    switch( nID )
     1182    {
     1183#ifndef THETEXT
     1184    case IDM_COMMUNITY:
     1185        OpenWebBrowser( "http://www.activebasic.com/forum/" );
     1186        break;
     1187    case IDM_COMMU_SEARCH:
     1188        OpenWebBrowser( "http://www.activebasic.com/forum/search.php" );
     1189        break;
     1190    case IDM_COMMU_PM:
     1191        OpenWebBrowser( "http://www.activebasic.com/forum/privmsg.php?folder=inbox" );
     1192        break;
     1193    case ID_COMMU_FORUM1:
     1194        OpenWebBrowser( "http://www.activebasic.com/forum/viewforum.php?f=1" );
     1195        break;
     1196    case ID_COMMU_FORUM2:
     1197        OpenWebBrowser( "http://www.activebasic.com/forum/viewforum.php?f=2" );
     1198        break;
     1199    case ID_COMMU_FORUM3:
     1200        OpenWebBrowser( "http://www.activebasic.com/forum/viewforum.php?f=5" );
     1201        break;
     1202    case ID_COMMU_FORUM4:
     1203        OpenWebBrowser( "http://www.activebasic.com/forum/viewforum.php?f=3" );
     1204        break;
     1205    case ID_COMMU_FORUM5:
     1206        OpenWebBrowser( "http://www.activebasic.com/forum/viewforum.php?f=6" );
     1207        break;
     1208    case ID_COMMU_FORUM6:
     1209        OpenWebBrowser( "http://www.activebasic.com/forum/viewforum.php?f=8" );
     1210        break;
     1211    case ID_COMMU_FORUM7:
     1212        OpenWebBrowser( "http://www.activebasic.com/forum/viewforum.php?f=4" );
     1213        break;
     1214    case ID_COMMU_FORUM8:
     1215        OpenWebBrowser( "http://www.activebasic.com/forum/viewforum.php?f=7" );
     1216        break;
     1217    case IDM_AB_WEBSITE:
     1218        OpenWebBrowser( "http://www.activebasic.com/" );
     1219        break;
     1220    case IDM_ACTBDL:
     1221        OpenWebBrowser( "http://www.activebasic.com/activebasic5/download.htm" );
     1222        break;
     1223#else
     1224    case IDM_DSHOMEPAGE:
     1225        OpenWebBrowser( "http://www.discoversoft.net/" );
     1226        break;
     1227#endif // not THETEXT
     1228    default:
     1229        throw;
     1230    }
     1231}
     1232
     1233void MainFrame::OnCmdTopics( UINT uNotifyCode, int nID, CWindow wndCtl )
     1234{
     1235    char temporary[1024];
     1236#ifdef THETEXT
     1237    sprintf(temporary,"%sTopics\\index.html",pj_editor_Dir);
     1238    ShellExecute(m_hWnd,"open",temporary,NULL,NULL,SW_SHOWNORMAL);
     1239#else
     1240    sprintf(temporary,"%sBasicHelp.chm",pj_editor_Dir);
     1241    HtmlHelp(NULL,temporary,HH_DISPLAY_TOPIC,0);
     1242#endif
     1243}
     1244
     1245void MainFrame::OnCmdAbout( UINT uNotifyCode, int nID, CWindow wndCtl )
     1246{
     1247    DialogBox(hResInst,MAKEINTRESOURCE(IDD_ABOUT),m_hWnd,(DLGPROC)DialogAbout);
     1248}
     1249
     1250void MainFrame::OnCmdDocSelectBand( UINT uNotifyCode, int nID, CWindow wndCtl )
     1251{
     1252    pobj_Rebar->ChangeRebarBand(ID_DOCCOMBO);
     1253}
     1254
     1255void MainFrame::OnCmdStandardBand( UINT uNotifyCode, int nID, CWindow wndCtl )
     1256{
     1257    pobj_Rebar->ChangeRebarBand(ID_STANDARDTOOLBAR);
     1258}
     1259
     1260void MainFrame::OnCmdReleaseBand( UINT uNotifyCode, int nID, CWindow wndCtl )
     1261{
     1262    pobj_Rebar->ChangeRebarBand(ID_RELEASETOOLBAR);
     1263}
     1264
     1265void MainFrame::OnCmdDebugBand( UINT uNotifyCode, int nID, CWindow wndCtl )
     1266{
     1267    pobj_Rebar->ChangeRebarBand(ID_DEBUGGERTOOLBAR);
     1268}
     1269
     1270void MainFrame::OnCmdSelectCompilerBand( UINT uNotifyCode, int nID, CWindow wndCtl )
     1271{
     1272    pobj_Rebar->ChangeRebarBand(ID_SELECTCOMPILERCOMBO);
     1273}
     1274
     1275void MainFrame::OnCmdNoGripper( UINT uNotifyCode, int nID, CWindow wndCtl )
     1276{
     1277    if(pobj_nv->bNoGripper) pobj_nv->bNoGripper=0;
     1278    else pobj_nv->bNoGripper=1;
     1279
     1280    //レバーコントロールを再生成
     1281    pobj_Rebar->ResetRebar();
     1282
     1283    //メニュー状態を設定
     1284    ResetState_DocMenu();
     1285}
     1286
     1287void MainFrame::OnCmdResetRebar( UINT uNotifyCode, int nID, CWindow wndCtl )
     1288{
     1289    //"ツールバーの配置をすべて初期状態に戻します。\nよろしいですか?"
     1290    if( MessageBox(STRING_TOOLBAR_RESET,APPLICATION_NAME,MB_OKCANCEL|MB_ICONEXCLAMATION) == IDCANCEL )
     1291    {
     1292        return;
     1293    }
     1294
     1295    //レバーコントロールを再生成
     1296    pobj_Rebar->ResetInitRebar();
     1297
     1298    //メニュー状態を設定
     1299    ResetState_DocMenu();
     1300}
     1301
     1302void MainFrame::OnCmdAllCloseOmitMyself( UINT uNotifyCode, int nID, CWindow wndCtl )
     1303{
     1304    //このウィンドウ以外をすべて閉じる(&A)
     1305    HWND hChild=::GetWindow(hClient,GW_CHILD);
     1306    int WndNum=GetWndNum(hChild);
     1307    for(int i=0;i<MAX_WNDNUM;i++){
     1308        if(i==WndNum) continue;
     1309        if(MdiInfo[i].hwnd) SendMessage(MdiInfo[i].hwnd,WM_CLOSE,0,0);
     1310    }
     1311}
     1312
     1313void MainFrame::OnCmdPathCopy( UINT uNotifyCode, int nID, CWindow wndCtl )
     1314{
     1315    HWND hChild=::GetWindow(hClient,GW_CHILD);
     1316    int WndNum=GetWndNum(hChild);
     1317
     1318    //絶対パスをコピー
     1319    HGLOBAL hGlobal=(char *)GlobalAlloc(GMEM_MOVEABLE,lstrlen(MdiInfo[WndNum].path)+1);
     1320    char *pTemp=(char *)GlobalLock(hGlobal);
     1321    lstrcpy(pTemp,MdiInfo[WndNum].path);
     1322    GlobalUnlock(hGlobal);
     1323
     1324    //クリップボードに保存
     1325    OpenClipboard();
     1326    EmptyClipboard();
     1327    SetClipboardData(CF_TEXT,hGlobal);
     1328    CloseClipboard();
     1329}
     1330
     1331void MainFrame::OnCmdFolderOpen( UINT uNotifyCode, int nID, CWindow wndCtl )
     1332{
     1333    HWND hChild=::GetWindow(hClient,GW_CHILD);
     1334    int WndNum=GetWndNum(hChild);
     1335
     1336    char temporary[1024], temp2[1024];
     1337    _splitpath(MdiInfo[WndNum].path,temporary,temp2,NULL,NULL);
     1338    lstrcat(temporary,temp2);
     1339
     1340    OpenExplorer( temporary );
     1341}
     1342
     1343void MainFrame::OnCmdDeleteFile( UINT uNotifyCode, int nID, CWindow wndCtl )
     1344{
     1345    HWND hChild=::GetWindow(hClient,GW_CHILD);
     1346    int WndNum=GetWndNum(hChild);
     1347
     1348    char temporary[1024], temp2[1024];
     1349    _splitpath(MdiInfo[WndNum].path,NULL,NULL,temporary,temp2);
     1350    lstrcat(temporary,temp2);
     1351
     1352    lstrcat(temporary," をごみ箱に移動して閉じます。よろしいですか?");
     1353    if(MessageBox(temporary,APPLICATION_NAME,MB_OKCANCEL|MB_ICONQUESTION)==IDCANCEL) return;
     1354
     1355    //ゴミ箱へ
     1356    SHFILEOPSTRUCT fo;
     1357    fo.hwnd=m_hWnd;
     1358    fo.wFunc=FO_DELETE;
     1359    fo.pFrom =MdiInfo[WndNum].path;
     1360    fo.pTo="\0";
     1361    fo.fFlags =FOF_ALLOWUNDO|FOF_NOCONFIRMATION;
     1362    SHFileOperation(&fo);
     1363
     1364    //閉じる
     1365    MdiInfo[WndNum].pMdiTextEdit->UnModify();
     1366    SendMessage(MdiInfo[WndNum].hwnd,WM_CLOSE,0,0);
     1367}
Note: See TracChangeset for help on using the changeset viewer.