BOOL CMainMDIFrame::OnCommand(WPARAM wParam, LPARAM lParam) { switch (LOWORD(wParam)) { case IDM_FILE_NEW: return OnFileNew(); case IDM_FILE_CLOSE: return OnFileClose(); case IDM_FILE_OPEN: return OnFileOpen(); case IDM_FILE_SAVE: return OnFileSave(); case IDM_FILE_SAVEAS: return OnFileSave(); case IDM_FILE_PRINT: return OnFilePrint(); case IDW_VIEW_STATUSBAR: return OnViewStatusBar(); case IDW_VIEW_TOOLBAR: return OnViewToolBar(); case IDW_MDI_ARRANGE: return OnMDIIconArrange(); case IDW_MDI_CASCADE: return OnMDICascade(); case IDW_MDI_CLOSEALL: return OnMDICloseAll(); case IDW_MDI_TILE: return OnMDITile(); case IDM_FILE_EXIT: return OnFileExit(); case IDM_HELP_ABOUT: return OnHelp(); default: // Pass to active child... { if (GetActiveMDIChild()) GetActiveMDIChild()->SendMessage(WM_COMMAND, wParam, lParam); } break ; } return FALSE; }
LRESULT CNotePad::OnCommand(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) { BOOL bRet = false; int wmId, wmEvent; wmId = LOWORD(wParam); wmEvent = HIWORD(wParam); switch (wmEvent) { case EN_CHANGE: bRet = 1; break; case EN_HSCROLL: bRet = 1; break; } // 分析菜单选择: switch (wmId) { case IDM_ABOUT: DialogBox(m_hInst, MAKEINTRESOURCE(IDD_ABOUTBOX), hWnd, About); break; case IDM_EXIT: DestroyWindow(hWnd); break; case ID_NEW: bRet = OnFileNew(hWnd, wParam, lParam); break; case ID_OPEN: bRet = OnFileOpen(hWnd, wParam, lParam); break; case ID_SAVE: bRet = OnFileSave(hWnd, wParam, lParam); break; case ID_SAVEAS: bRet = OnFileSaveAs(hWnd, wParam, lParam); break; case ID_PRINT: bRet = OnFilePrint(hWnd, wParam, lParam); break; case ID_PAGESET: bRet = OnPageSet(hWnd, wParam, lParam); break; case ID_COPY: bRet = OnFileCopy(hWnd, wParam, lParam); break; case ID_PASTE: bRet = OnFilePaste(hWnd, wParam, lParam); break; case ID_COLOR: bRet = OnColor(hWnd, wParam, lParam); break; case ID_FONT: bRet = OnFont(hWnd, wParam, lParam); break; default: return DefWindowProc(hWnd, uMsg, wParam, lParam); } return bRet; }
int MainWindow::qt_metacall(QMetaObject::Call _c, int _id, void **_a) { _id = Q3MainWindow::qt_metacall(_c, _id, _a); if (_id < 0) return _id; if (_c == QMetaObject::InvokeMetaMethod) { switch (_id) { case 0: OnFileNew(); break; case 1: OnFileEdit(); break; case 2: OnFileOpen(); break; case 3: OnFileSave(); break; case 4: OnFileConfig(); break; case 5: OnFileExit(); break; case 6: OnSimRun(); break; case 7: OnSimPause(); break; case 8: OnSimSkip(); break; case 9: OnSimStop(); break; case 10: OnNetInit(); break; case 11: OnNetClose(); break; case 12: OnNetServer(); break; case 13: OnNetServer((*reinterpret_cast< int(*)>(_a[1]))); break; default: ; } _id -= 14; } return _id; }
void CGuiderView::OnFileNew() { // TODO: 在此添加命令处理程序代码 if((sitelist.Head!=NULL||routelist.Head!=NULL))//有操作 { App_Veriable::FileOpenPathName=L""; if(App_Veriable::FileIsSaved==false) { if(IDOK==MessageBoxW(L"是否保存所做的更改?",L"Guider",1)) { OnFileSave(); } } sitelist.Destroy(); routelist.Destroy(); CGuiderDoc* pDoc = GetDocument(); pDoc->graph_doc.Destroy(); for(int i=0;i<64;i++) //将点插入图中 pDoc->graph_doc.insertv (-(i+1)); pDoc->graph_doc .removev (-33); paint_road_point(); Site::_ID_=0;//清空地点链表全局ID必须清0 App_Veriable::FileIsSaved=false; Invalidate(); } }
BOOL CMainFrame::OnCommand(WPARAM wParam, LPARAM lParam) { // Process the messages from the Menu and Tool Bar UNREFERENCED_PARAMETER(lParam); switch (LOWORD(wParam)) { case IDM_FILE_NEW: OnFileNew(); return TRUE; case IDM_FILE_OPEN: OnFileOpen(); return TRUE; case IDM_FILE_SAVE: OnFileSave(); return TRUE; case IDM_FILE_SAVEAS: OnFileSaveAs(); return TRUE; case IDM_FILE_PRINT: OnFilePrint(); return TRUE; case IDM_PEN_COLOR: OnPenColor(); return TRUE; case IDM_FILE_EXIT: OnFileExit(); return TRUE; case IDW_FILE_MRU_FILE1: case IDW_FILE_MRU_FILE2: case IDW_FILE_MRU_FILE3: case IDW_FILE_MRU_FILE4: case IDW_FILE_MRU_FILE5: OnFileMRU(wParam); return TRUE; case IDW_VIEW_STATUSBAR: return OnViewStatusBar(); case IDW_VIEW_TOOLBAR: return OnViewToolBar(); case IDM_HELP_ABOUT: return OnHelp(); } return FALSE; }
// **************************************************************************** // // Function Name: RStandaloneDocument::OnSave( ) // // Description: Command handler // // Returns: Nothing // // Exceptions: None // // **************************************************************************** // void RStandaloneDocument::OnSave( ) { // Save if the doc is dirty or hasn't been saved yet. // Broderbund wants save to be available always so we test here // instead of in the OnUpdateSave. if ( m_pUndoManager->DocDirty() || (NULL == m_pDocumentStorage) ) OnFileSave( FALSE ); }
BOOL CMainFrame::OnCommand(WPARAM wParam, LPARAM lParam) { // OnCommand responds to menu and and toolbar input UNREFERENCED_PARAMETER(lParam); switch (LOWORD(wParam)) { case IDM_FILE_OPEN: // Refer to the tutorial for an example of OnFileOpen OnFileOpen(); return TRUE; case IDM_FILE_SAVE: // Refer to the tutorial for an example of OnFileSave OnFileSave(); return TRUE; case IDM_FILE_SAVEAS: // Refer to the tutorial for an example of OnFileSaveAs OnFileSave(); return TRUE; case IDM_FILE_PRINT: OnFilePrint(); return TRUE; case IDM_FILE_EXIT: // End the application ::PostMessage(m_hWnd, WM_CLOSE, 0, 0); return TRUE; case IDW_VIEW_STATUSBAR: OnViewStatusBar(); return TRUE; case IDW_VIEW_TOOLBAR: OnViewToolBar(); return TRUE; case IDM_HELP_ABOUT: // Display the help dialog OnHelp(); return TRUE; } return FALSE; }
BOOL CMainMDIFrame::OnCommand(WPARAM wParam, LPARAM lParam) { switch (LOWORD(wParam)) { case IDM_FILE_NEW: AddMDIChild(new CSimpleMDIChild); // CMDIFrame::RemoveMDIChild deletes this pointer return TRUE; case IDM_FILE_CLOSE: // Close the active MDI window GetActiveMDIChild()->SendMessage(WM_CLOSE, 0, 0); return TRUE; case IDM_FILE_OPEN: OnFileOpen(); return TRUE; case IDM_FILE_SAVE: OnFileSave(); return TRUE; case IDM_FILE_SAVEAS: OnFileSaveAs(); return TRUE; case IDM_FILE_PRINT: OnFilePrint(); return TRUE; case IDW_VIEW_STATUSBAR: OnViewStatusbar(); break; case IDW_VIEW_TOOLBAR: OnViewToolbar(); break; case IDW_WINDOW_ARRANGE: ::PostMessage (GetView()->GetHwnd(), WM_MDIICONARRANGE, 0L, 0L) ; break; case IDW_WINDOW_CASCADE: ::PostMessage (GetView()->GetHwnd(), WM_MDICASCADE, 0L, 0L) ; break; case IDW_WINDOW_CLOSEALL: RemoveAllMDIChildren(); break; case IDW_WINDOW_TILE: ::PostMessage (GetView()->GetHwnd(), WM_MDITILE, 0L, 0L) ; break; default: // Pass to active child... { if (GetActiveMDIChild()) GetActiveMDIChild()->SendMessage(WM_COMMAND, wParam, lParam); } break ; case IDM_FILE_EXIT: ::PostMessage(m_hWnd, WM_CLOSE, 0, 0); return TRUE; case IDM_HELP_ABOUT: OnHelp(); return TRUE; } return FALSE; }
BOOL CMainFrame::OnCommand(WPARAM wParam, LPARAM lParam) { // OnCommand responds to menu and and toolbar input UNREFERENCED_PARAMETER(lParam); switch(LOWORD(wParam)) { case IDM_FILE_OPEN: return OnFileOpen(); case IDM_FILE_SAVE: return OnFileSave(); case IDM_FILE_SAVEAS: return OnFileSave(); case IDM_FILE_PRINT: return OnFilePrint(); case IDM_FILE_EXIT: return OnFileExit(); case IDW_VIEW_STATUSBAR: return OnViewStatusBar(); case IDW_VIEW_TOOLBAR: return OnViewToolBar(); case IDM_HELP_ABOUT: return OnHelp(); } return FALSE; }
BOOL CMainFrame::OnCommand(WPARAM wParam, LPARAM lParam) { // OnCommand responds to menu and and toolbar input UNREFERENCED_PARAMETER(lParam); switch(LOWORD(wParam)) { case IDM_FILE_OPEN: OnFileOpen(); return TRUE; case IDM_FILE_SAVE: OnFileSave(); return TRUE; case IDM_FILE_SAVEAS: OnFileSave(); return TRUE; case IDM_FILE_PRINT: OnFilePrint(); return TRUE; case IDM_FILE_EXIT: OnFileExit(); return TRUE; case IDW_VIEW_STATUSBAR: OnViewStatusBar(); return TRUE; case IDW_VIEW_TOOLBAR: OnViewToolBar(); return TRUE; case IDM_TOOLBAR_CUSTOMIZE: OnTBCustomize(); return TRUE; case IDM_TOOLBAR_DEFAULT: OnTBDefault(); return TRUE; case IDM_TOOLBAR_BIGICONS: OnTBBigIcons(); return TRUE; case IDM_HELP_ABOUT: OnHelp(); return TRUE; } return FALSE; }
BOOL CMapEditorView::IsMapCanChange() { //判断文件是否被修改过,若被修改过,则提示保存。Open会根据返回的情况来判断是否打开文件选择对话框。 if(g_mapEditor.IsHasData() && g_mapEditor.IsModified()) { int rv = ::MessageBoxEx(m_hWnd, _T("文件已修改,是否保存?"), _T("保存文件"), MB_YESNOCANCEL, 0); if(rv == IDYES) { BOOL b; OnFileSave(0, 0, NULL, b); } else { if( rv == IDCANCEL) return FALSE; } } return TRUE; }
BOOL CMainFrame::OnCommand(WPARAM wParam, LPARAM lParam) { // Process the messages from the Menu and Tool Bar switch (LOWORD(wParam)) { case IDM_FILE_NEW: m_View.ClearPoints(); m_PathName = _T(""); return TRUE; case IDM_FILE_OPEN: OnFileOpen(); return TRUE; case IDM_FILE_SAVE: OnFileSave(); return TRUE; case IDM_FILE_SAVEAS: OnFileSaveAs(); return TRUE; case IDM_FILE_PRINT: ::MessageBox(NULL, _T("File Print Implemented Later"), _T("Menu"), MB_OK); return TRUE; case IDM_PEN_RED: m_View.SetPen(RGB(255,0,0)); return TRUE; case IDM_PEN_BLUE: m_View.SetPen(RGB(0,0,255)); return TRUE; case IDM_PEN_GREEN: m_View.SetPen(RGB(0,196,0)); return TRUE; case IDM_PEN_BLACK: m_View.SetPen(RGB(0,0,0)); return TRUE; case IDM_HELP_ABOUT: OnHelp(); return TRUE; case IDM_FILE_EXIT: ::PostMessage(m_hWnd, WM_CLOSE, 0, 0); return TRUE; } return FALSE; }
BOOL CMainFrame::OnCommand(WPARAM wParam, LPARAM lParam) { // Process the messages from the (non-ribbon) Menu and Tool Bar UNREFERENCED_PARAMETER(lParam); switch (LOWORD(wParam)) { case IDM_FILE_NEW: OnFileNew(); return TRUE; case IDM_FILE_OPEN: OnFileOpen(); return TRUE; case IDM_FILE_SAVE: OnFileSave(); return TRUE; case IDM_FILE_SAVEAS: OnFileSaveAs(); return TRUE; case IDM_FILE_PRINT: OnFilePrint(); return TRUE; case IDM_FILE_EXIT: OnFileExit(); return TRUE; case IDW_FILE_MRU_FILE1: case IDW_FILE_MRU_FILE2: case IDW_FILE_MRU_FILE3: case IDW_FILE_MRU_FILE4: case IDW_FILE_MRU_FILE5: { UINT uMRUEntry = LOWORD(wParam) - IDW_FILE_MRU_FILE1; MRUFileOpen(uMRUEntry); return TRUE; } case IDM_PEN_RED: SetPenColor(RGB(255, 0, 0)); return TRUE; case IDM_PEN_BLUE: SetPenColor(RGB(0, 0, 255)); return TRUE; case IDM_PEN_GREEN: SetPenColor(RGB(0, 196, 0)); return TRUE; case IDM_PEN_BLACK: SetPenColor(RGB(0, 0, 0)); return TRUE; case IDW_VIEW_STATUSBAR: return OnViewStatusBar(); case IDW_VIEW_TOOLBAR: return OnViewToolBar(); case IDM_HELP_ABOUT: return OnHelp(); } return FALSE; }
bool CScriptEditView::QueryClose() { if( !GetModify() ) return true; TCHAR szFmt[32]; AtlLoadString( IDS_SAVE_MODIFIED, szFmt, DIMOF(szFmt) ); TCHAR szBuff[MAX_PATH + 40]; wsprintf( szBuff, szFmt, m_szFileName ); int nRet = AtlMessageBox( WtlGetMainWnd(), szBuff, IDR_MAINFRAME, MB_YESNOCANCEL | MB_ICONEXCLAMATION ); if(nRet == IDCANCEL) return false; if(nRet == IDYES) return OnFileSave(); return true; }
STDMETHODIMP CMainFrame::Execute(UINT32 nCmdID, UI_EXECUTIONVERB verb, const PROPERTYKEY* key, const PROPVARIANT* ppropvarValue, IUISimplePropertySet* pCmdExProp) { // This function is called when a ribbon button is pressed. // Refer to IUICommandHandler::Execute in the Windows 7 SDK documentation if (UI_EXECUTIONVERB_EXECUTE == verb) { switch(nCmdID) { case IDC_CMD_NEW: OnFileNew(); break; case IDC_CMD_OPEN: OnFileOpen(); break; case IDC_CMD_SAVE: OnFileSave(); break; case IDC_CMD_SAVE_AS: OnFileSaveAs(); break; case IDC_CMD_PRINT: OnFilePrint(); break; case IDC_CMD_COPY: TRACE("Copy\n"); break; case IDC_CMD_CUT: TRACE("Cut\n"); break; case IDC_CMD_PASTE: TRACE("Paste\n"); break; case IDC_CMD_ABOUT: OnHelp(); break; case IDC_CMD_EXIT: OnFileExit(); break; case IDC_RICHFONT: TRACE("Font dialog\n"); break; case IDC_RIBBONHELP: OnHelp(); break; case IDC_MRULIST: OnMRUList(key, ppropvarValue); break; case IDC_PEN_COLOR: OnPenColor(ppropvarValue, pCmdExProp); break; case IDC_CUSTOMIZE_QAT: TRACE("Customize Quick Access ToolBar\n"); break; default: { CString str; str.Format(_T("Unknown Button %d\n"),nCmdID); TRACE(str); } break; } } return S_OK; }
BOOL CMainFrame::OnCommand(WPARAM wParam, LPARAM lParam) { UNREFERENCED_PARAMETER(lParam); // Process the messages from the Menu and Tool Bar switch (LOWORD(wParam)) { case IDM_FILE_NEW: OnFileNew(); return TRUE; case IDM_FILE_OPEN: OnFileOpen(); return TRUE; case IDM_FILE_SAVE: OnFileSave(); return TRUE; case IDM_FILE_SAVEAS: OnFileSaveAs(); return TRUE; case IDM_FILE_PRINT: OnFilePrint(); return TRUE; case IDM_PEN_RED: OnPenRed(); return TRUE; case IDM_PEN_BLUE: OnPenBlue(); return TRUE; case IDM_PEN_GREEN: OnPenGreen(); return TRUE; case IDM_PEN_BLACK: OnPenBlack(); return TRUE; case IDW_VIEW_STATUSBAR: OnViewStatusBar(); return TRUE; case IDW_VIEW_TOOLBAR: OnViewToolBar(); return TRUE; case IDM_HELP_ABOUT: OnHelp(); return TRUE; case IDM_FILE_EXIT: OnFileExit(); return TRUE; } return FALSE; }
BOOL CDrawProgDoc::OnSaveDocument(LPCTSTR lpszPathName) { OnFileSave(); return 1;//CDocument::OnSaveDocument(lpszPathName); }
void CTestCBotDoc::OnRun() { OnFileSave(); m_pEdit->GetWindowText(m_DocText); CString TextError; int code, start, end; if ( m_pProg == NULL ) m_pProg = new CBotProgram(); CTestCBotApp* pApp = (CTestCBotApp*)AfxGetApp(); if (!m_pProg->Compile(m_DocText, m_Liste, NULL)) { m_pProg->GetError(code, start, end); delete m_pProg; m_pProg = NULL; m_pEdit->SetSel( start, end ); m_pEdit->SetFocus(); // met en évidence la partie avec problème TextError = CBotProgram::GivErrorText( code ); AfxMessageBox( TextError ); m_pEdit->SetFocus(); return; } if( m_Liste.GivSize() == 0 ) { AfxMessageBox("Aucune fonction marquée \"extern\" !"); return; } for ( int i = 0; i < m_Liste.GivSize(); i++ ) { int start, stop; m_pProg->GetPosition(m_Liste[i], start, stop, GetPosNom, GetPosParam); m_Liste[i] = m_DocText.Mid( start, stop-start ); } CBotConsoleDlg dlg; dlg.m_pListe = &m_Liste; dlg.m_pEditx = m_pEdit; dlg.DoModal(); // dialogue pour faire la console if ( dlg.m_code>0 ) { CString TextError; TextError = m_pProg->GivErrorText( dlg.m_code ); m_pEdit->SetSel( dlg.m_start, dlg.m_end ); m_pEdit->SetFocus(); // met en évidence la partie avec problème AfxMessageBox(TextError); } m_pEdit->SetFocus(); return; }
void CTestCBotDoc::OnTest() { CBotProgram::DefineNum("WingedGrabber", 1); CBotProgram::DefineNum("TrackedGrabber", 2); CBotProgram::DefineNum("WheeledGrabber", 3); CBotProgram::DefineNum("LeggedGrabber", 4); CBotProgram::DefineNum("WingedShooter", 5); CBotProgram::DefineNum("TrackedShooter", 6); CBotProgram::DefineNum("WheeledShooter", 7); CBotProgram::DefineNum("LeggedShooter", 8); CBotProgram::DefineNum("WingedOrgaShooter", 9); CBotProgram::DefineNum("TrackedOrgaShooter", 10); CBotProgram::DefineNum("WheeledOrgaShooter", 11); CBotProgram::DefineNum("LeggedOrgaShooter", 12); CBotProgram::DefineNum("WingedSniffer", 13); CBotProgram::DefineNum("TrackedSniffer", 14); CBotProgram::DefineNum("WheeledSniffer", 14); CBotProgram::DefineNum("LeggedSniffer", 15); CBotProgram::DefineNum("Thumper", 16); CBotProgram::DefineNum("PhazerShooter", 17); CBotProgram::DefineNum("Recycler", 18); CBotProgram::DefineNum("Shielder", 19); CBotProgram::DefineNum("Subber", 20); CBotProgram::DefineNum("Me", 21); CBotProgram::DefineNum("TypeMarkPath", 111); OnFileSave(); // CPerformDlg dlg; // dlg.m_Script = m_DocText; // dlg.DoModal(); // défini la routine RetObject CBotProgram::AddFunction( "Radar", rRetObject, cRetObject ); // ajoute une routine pour cette classe CBotProgram::AddFunction("Space", rSpace, cSpace); // défini la routine Test CBotProgram::AddFunction( "TEST", rTEST, cTEST ); CBotProgram::AddFunction( "F", rF, cF ); CBotProgram::AddFunction( "goto", rMove, cMove ); CBotProgram::AddFunction( "fire", rTurn, cTurn ); CBotProgram::AddFunction( "radar", rRadar, cRadar ); // crée une instance de la classe "Bot" pour ce robot CBotVar* pThisRobot = CBotVar::Create( "", CBotTypResult(CBotTypClass, "object") ); pThisRobot->SetUserPtr( (void*)1 ); pThisRobot->SetIdent( 1234 ); delete m_pProg; // crée un objet programme associé à cette instance m_pProg = new CBotProgram(pThisRobot); // compile le programme CString TextError; int code, start, end; m_pEdit->GetWindowText(m_DocText); if (!m_pProg->Compile(m_DocText, m_Liste, (void*) 44)) { m_pProg->GetError(code, start, end); delete m_pProg; m_pProg = NULL; delete pThisRobot; m_pEdit->SetSel( start, end ); m_pEdit->SetFocus(); // met en évidence la partie avec problème TextError = CBotProgram::GivErrorText( code ); AfxMessageBox( TextError ); m_pEdit->SetFocus(); return; } // exécute pour voir m_pProg->Start(m_Liste[0]); int mode = -1; if ( mode >= 0 ) { // sauve et restore à chaque pas possible while (!m_pProg->Run(NULL, 1)) { const char* FunctionName; int start1, end1; m_pProg->GetRunPos(FunctionName, start1, end1); if ( end1 <= 0 ) m_pProg->GetRunPos(FunctionName, start1, end1); m_pEdit->SetSel(start1, end1); if ( mode == 0 ) continue; FILE* pf; pf = fOpen( "TEST.CBO", "wb" ); CBotClass::SaveStaticState(pf); m_pProg->SaveState(pf); fClose(pf); if ( mode == 2 ) if (!m_pProg->Compile(m_DocText, m_Liste, (void*) 44)) { m_pProg->GetError(code, start, end); delete m_pProg; m_pProg = NULL; delete pThisRobot; m_pEdit->SetSel( start, end ); m_pEdit->SetFocus(); // met en évidence la partie avec problème TextError = CBotProgram::GivErrorText( code ); AfxMessageBox( TextError ); m_pEdit->SetFocus(); return; } pf = fOpen( "TEST.CBO", "rb" ); CBotClass::RestoreStaticState(pf); m_pProg->RestoreState(pf); fClose(pf); int start2, end2; m_pProg->GetRunPos(FunctionName, start2, end2); if ( end2 <= 0 ) m_pProg->GetRunPos(FunctionName, start2, end2); if ( start1 != start2 || end1 != end2 ) m_pProg->GetRunPos(FunctionName, start2, end2); m_pEdit->SetSel(start2, end2); } if (m_pProg->GetError(code, start, end)) { m_pEdit->SetSel(start, end); TextError = CBotProgram::GivErrorText(code); AfxMessageBox(TextError); } return;} while (!m_pProg->Run(NULL, 0)) { const char* FunctionName; int start, end; m_pProg->GetRunPos(FunctionName, start, end); m_pEdit->SetSel(start, end); if ( FunctionName == NULL ) continue; CString info (FunctionName); CString sep (":\n"); int level = 0; const char* Name; while ( TRUE ) { CBotVar* pVar = m_pProg->GivStackVars(Name, level--); if ( Name != FunctionName ) break; if ( pVar == NULL ) continue; // pVar->Maj(NULL, FALSE); while ( pVar != NULL ) { info += sep; info += pVar->GivName() + CBotString(" = ") + pVar->GivValString(); sep = ", "; pVar = pVar->GivNext(); } sep = "\n"; } if ( IDOK != AfxMessageBox(info, MB_OKCANCEL) ) break; if ( test == 1 ) { test = 0; FILE* pf; pf = fOpen( "TEST.CBO", "wb" ); m_pProg->SaveState(pf); fClose(pf); } if ( test == 2 ) { test = 0; FILE* pf; pf = fOpen( "TEST.CBO", "rb" ); m_pProg->RestoreState(pf); fClose(pf); } if ( test == 12 ) { test = 0; FILE* pf; pf = fOpen( "TEST.CBO", "wb" ); m_pProg->SaveState(pf); fClose(pf); pf = fOpen( "TEST.CBO", "rb" ); m_pProg->RestoreState(pf); fClose(pf); test = 13; } } if (m_pProg->GetError(code, start, end)) { m_pEdit->SetSel(start, end); TextError = CBotProgram::GivErrorText(code); AfxMessageBox(TextError); } delete pThisRobot; }
MainWindow::MainWindow() : QMainWindow( 0, "MainWindow", WDestructiveClose ) { QDockWindow * pNMWindow; std::map<QString, ServerCreator>::iterator iterCreator; m_pCentralWidget = new QWorkspace(this, "CENTRALWIDGET"); m_pCentralWidget->setScrollBarsEnabled(true); setIcon(app32x32_xpm); setCentralWidget(m_pCentralWidget); // create menus m_pFileMenu = new QPopupMenu(this, "File Menu"); m_pFileNew = new QAction("&New...", QAccel::stringToKey("Ctrl+N"), this, "file.new"); m_pFileNew->setToolTip("Create a new simulation file, ending the current simulation"); connect(m_pFileNew, SIGNAL(activated()), this, SLOT(OnFileNew())); m_pFileNew->addTo(m_pFileMenu); m_pFileEdit = new QAction("&Edit...", QAccel::stringToKey("Ctrl+E"), this, "file.edit"); m_pFileEdit->setToolTip("Edit the current simulation file, ending the current simulation"); connect(m_pFileEdit, SIGNAL(activated()), this, SLOT(OnFileEdit())); m_pFileEdit->setEnabled(false); m_pFileEdit->addTo(m_pFileMenu); m_pFileOpen = new QAction(QPixmap(fileopen), "&Open...", QAccel::stringToKey("Ctrl+O"), this, "file.open"); m_pFileOpen->setToolTip("Open a simulation file, ending the current simulation"); connect(m_pFileOpen, SIGNAL(activated()), this, SLOT(OnFileOpen())); m_pFileOpen->addTo(m_pFileMenu); m_pFileSave = new QAction(QPixmap(filesave), "&Save As...", QAccel::stringToKey("Ctrl+S"), this, "file.save"); m_pFileSave->setToolTip("Save the current setup to a simulation file (this ends any running simulation)"); connect(m_pFileSave, SIGNAL(activated()), this, SLOT(OnFileSave())); m_pFileSave->setEnabled(false); m_pFileSave->addTo(m_pFileMenu); m_pFileMenu->insertSeparator(); m_pFileConfig = new QAction("&Configure...", QKeySequence(), this, "file.config"); m_pFileConfig->setToolTip("Edit the current configuration"); connect(m_pFileConfig, SIGNAL(activated()), this, SLOT(OnFileConfig())); m_pFileConfig->addTo(m_pFileMenu); m_pFileExit = new QAction("E&xit...", QAccel::stringToKey("Ctrl+Q"), this, "file.exit"); m_pFileExit->setToolTip("Exit the program"); connect(m_pFileExit, SIGNAL(activated()), this, SLOT(OnFileExit())); m_pFileExit->addTo(m_pFileMenu); m_pSimMenu = new QPopupMenu(this, "Sim Menu"); m_pSimRun = new QAction("&Run...", QKeySequence(Qt::Key_F2), this, "sim.run"); m_pSimRun->setToolTip("Start a new simulation"); connect(m_pSimRun, SIGNAL(activated()), this, SLOT(OnSimRun())); m_pSimRun->setEnabled(false); m_pSimRun->addTo(m_pSimMenu); m_pSimPause = new QAction("Pause", QKeySequence(Qt::Key_F3), this, "sim.pause"); m_pSimPause->setToolTip("Pause the currently running simulation"); m_pSimPause->setEnabled(false); connect(m_pSimPause, SIGNAL(activated()), this, SLOT(OnSimPause())); m_pSimPause->addTo(m_pSimMenu); m_pSimSkip = new QAction("Skip to next", QKeySequence(), this, "sim.skip"); m_pSimSkip->setToolTip("Skip to the next Monte Carlo iteration of the simulation"); m_pSimSkip->setEnabled(false); connect(m_pSimSkip, SIGNAL(activated()), this, SLOT(OnSimSkip())); m_pSimSkip->addTo(m_pSimMenu); m_pSimStop = new QAction("&Stop", QKeySequence(Qt::SHIFT | Qt::Key_F2), this, "sim.stop"); m_pSimStop->setToolTip("Stop the currently running simulation"); m_pSimStop->setEnabled(false); connect(m_pSimStop, SIGNAL(activated()), this, SLOT(OnSimStop())); m_pSimStop->addTo(m_pSimMenu); m_pNetMenu = new QPopupMenu(this, "Net Menu"); m_pNetInit = new QAction("&Initialize", QKeySequence(), this, "net.init"); m_pNetInit->setToolTip("Initialize network devices and connections"); m_pNetInit->setEnabled(true); connect(m_pNetInit, SIGNAL(activated()), this, SLOT(OnNetInit())); m_pNetInit->addTo(m_pNetMenu); m_pNetClose = new QAction("&Close", QKeySequence(), this, "net.close"); m_pNetClose->setToolTip("Close network devices and connections"); m_pNetClose->setEnabled(false); connect(m_pNetClose, SIGNAL(activated()), this, SLOT(OnNetClose())); m_pNetClose->addTo(m_pNetMenu); m_pNetServer = new QAction("&Stop Server", QKeySequence(), this, "net.server"); m_pNetServer->setToolTip("Stop GrooveNet server"); connect(m_pNetServer, SIGNAL(activated()), this, SLOT(OnNetServer())); m_pNetServerMenu = new QPopupMenu(this, "startserver"); connect(m_pNetServerMenu, SIGNAL(activated(int)), this, SLOT(OnNetServer(int))); for (iterCreator = g_mapServerCreators.begin(); iterCreator != g_mapServerCreators.end(); ++iterCreator) m_pNetServerMenu->insertItem(iterCreator->first); m_iNetServerMenuID = m_pNetMenu->insertItem("&Start Server", m_pNetServerMenu); m_pWindowMenu = new QPopupMenu(this, "Window Menu"); m_pWindowCascade = new QAction("&Cascade", QKeySequence(), this, "window.cascade"); m_pWindowCascade->setToolTip("Cascade all open windows"); connect(m_pWindowCascade, SIGNAL(activated()), m_pCentralWidget, SLOT(cascade())); m_pWindowCascade->addTo(m_pWindowMenu); m_pWindowTile = new QAction("&Tile", QKeySequence(), this, "window.tile"); m_pWindowTile->setToolTip("Tile all open windows"); connect(m_pWindowTile, SIGNAL(activated()), m_pCentralWidget, SLOT(tile())); m_pWindowTile->addTo(m_pWindowMenu); m_pWindowCloseAll = new QAction("Close &All Windows", QKeySequence(), this, "window.closeall"); m_pWindowCloseAll->setToolTip("Close all open windows"); connect(m_pWindowCloseAll, SIGNAL(activated()), m_pCentralWidget, SLOT(closeAllWindows())); m_pWindowCloseAll->addTo(m_pWindowMenu); menuBar()->insertItem("&File", m_pFileMenu); menuBar()->insertItem("&Simulator", m_pSimMenu); menuBar()->insertItem("&Network", m_pNetMenu); menuBar()->insertItem("&Window", m_pWindowMenu); statusBar()->addWidget(m_pLblStatus = new QLabel("Ready", this, "statusbar.label"), 1); statusBar()->setSizeGripEnabled(true); /* pNMWindow = new QDockWindow(this); pNMWindow->setCaption("Network Manager"); pNMWindow->setHorizontallyStretchable(true); pNMWindow->setVerticallyStretchable(false); pNMWindow->setResizeEnabled(true); pNMWindow->setMovingEnabled(true); pNMWindow->setCloseMode(QDockWindow::Always); m_pNetworkManager = new QNetworkManager(pNMWindow, "network manager"); pNMWindow->setWidget(m_pNetworkManager); addDockWindow(pNMWindow, Qt::DockBottom, true); */ tabsContainer = new QToolBar(this); tabsWidget = new QTabWidget(tabsContainer, "tabs"); tabsWidget->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding); tabsWidget->setMargin(8); tabsContainer->setStretchableWidget(tabsWidget); tabsContainer->setLabel(tr("GrooveNet - Tooltabs")); addDockWindow(tabsContainer, Qt::DockBottom, TRUE); m_pNetworkManager = new QNetworkManager(tabsContainer, "network manager"); tabsWidget->addTab(m_pNetworkManager, QString("Network Manager")); m_pMessageList = new QMessageList(tabsContainer, "message list"); tabsWidget->addTab(m_pMessageList, QString("Messages")); setAppropriate(tabsContainer, false); tabsWidget->addTab(NULL, QString("Congestion Info")); tabsWidget->addTab(NULL, QString("Playback")); }
// **************************************************************************** // // Function Name: RStandaloneDocument::OnSaveAs( ) // // Description: Command handler // // Returns: Nothing // // Exceptions: None // // **************************************************************************** // void RStandaloneDocument::OnSaveAs( ) { OnFileSave( TRUE ); }
// OnFileSave is protected so call it from this function which is public void CDrawProgDoc::SaveUserDefDoc() { OnFileSave(); }