void EHandler::Terminate() { #if defined (__wxWIN168B__) // Terminate the program using the wxExit() function. wxExit(); // Exits application after calling wxApp::OnExit. Should only // be used in an emergency: normally the top-level frame should // be deleted (after deleting all other frames) to terminate the // application. #elif defined (__wxWIN201__) || (__wxWIN291__) // Terminate the program using the wxExit() function. wxExit(); #elif defined (__wxWIN302__) // Terminate the program using the wxExit() function. wxExit(); #elif defined (__CURSES__) // Terminate the program abnormally terminal->finish(); exit(FatalErrorLevel); #elif defined (__CONSOLE__) // Terminate the program abnormally exit(FatalErrorLevel); #elif defined (__WIN32_ERROR_MSG__) // Terminate the program abnormally exit(FatalErrorLevel); #else // Allow the library to be compiled without a display type #endif }
//////////////////////////////////////////////////////////////////// // Method: On Init // Class: Cwxopencv // Purose: initialize my application // Input: nothing // Output: nothing //////////////////////////////////////////////////////////////////// bool Cwxopencv::OnInit( ) { // create camera object m_pCamera = new CCamera( ); // create widows frame CGUIFrame* m_pFrame = new CGUIFrame( NULL, "wxOpenCv Demo", wxPoint(-1, -1), wxSize(640, 600) ); // Show the frame m_pFrame->Show(TRUE); SetTopWindow(m_pFrame); // set parent m_pFrame->m_pWxopencv = this; // build worker thread to process video stream m_pWxopencvWorker = new CwxopencvWorker( m_pFrame ); // create thread or fail on exit if ( m_pWxopencvWorker->Create() != wxTHREAD_NO_ERROR ) { wxExit( ); } // exchange data if gui defined CCamView *pCamView = m_pFrame->GetCameraView(); // link robot to GUI m_pFrame->m_pWorker = m_pWxopencvWorker; m_pWxopencvWorker->m_pCamera = m_pCamera; m_pCamera->m_pWorker = m_pWxopencvWorker; // initialize camera if( m_pCamera->Init( ) == 0 ) { wxMessageBox( "Can't initialize camera. Try to change format", "Error" ); } m_pCamera->m_pCameraView = pCamView; m_pCamera->m_pFrame = m_pFrame; // Link camera view to camera object pCamView->m_pCamera = m_pCamera; // start the thread if ( m_pWxopencvWorker->Run() != wxTHREAD_NO_ERROR ) { wxExit( ); } return TRUE; }
// Get Master List button click void dlgMain::OnGetList(wxCommandEvent &event) { // prevent reentrancy static wxRecursionGuardFlag s_rgf; wxRecursionGuard recursion_guard(s_rgf); if (recursion_guard.IsInside()) return; if (GetThread() && GetThread()->IsRunning()) return; m_LstCtrlServers->DeleteAllItems(); m_LstCtrlPlayers->DeleteAllItems(); QueriedServers = 0; TotalPlayers = 0; mtcs_Request.Signal = mtcs_getmaster; if (GetThread() && GetThread()->IsRunning()) return; // Create monitor thread and run it if (this->wxThreadHelper::Create() != wxTHREAD_NO_ERROR) { wxMessageBox(_T("Could not create monitor thread!"), _T("Error"), wxOK | wxICON_ERROR); wxExit(); } GetThread()->Run(); }
void wxLuaConsole::OnCloseWindow(wxCloseEvent&) { m_pApp->SetLuaConsole(NULL); Destroy(); if (m_fError) wxExit(); }
void MyApp::OnFileMenu(wxCommandEvent &ev) { switch(ev.GetId()) { case wxMaxima::mac_newId: NewWindow(); break; case wxMaxima::mac_openId: { wxString file = wxFileSelector(_("Open"), wxEmptyString, wxEmptyString, wxEmptyString, _("wxMaxima document (*.wxm, *.wxmx)|*.wxm;*.wxmx"), wxFD_OPEN); if (file.Length() > 0) NewWindow(file); } break; case wxID_EXIT: { #if defined __WXMAC__ bool quit = true; wxWindowList::compatibility_iterator node = topLevelWindows.GetFirst(); while (node) { wxWindow *frame = node->GetData(); node = node->GetNext(); frame->Raise(); if (!frame->Close()) { quit = false; break; } } if (quit) wxExit(); #else wxWindow *frame = GetTopWindow(); if (frame == NULL) wxExit(); else if (frame->Close()) wxExit(); #endif } break; } }
void wxLuaConsole::OnCloseWindow(wxCloseEvent&) { // Must NULL the console so nobody will try to still use it. if (sm_wxluaConsole == this) sm_wxluaConsole = NULL; Destroy(); if (m_exit_when_closed) wxExit(); }
/** * Open update dialog */ void MainFrame::OnMenuItem36Selected(wxCommandEvent& event) { #ifndef GD_NO_UPDATE_CHECKER MAJ dialog(this); if ( dialog.ShowModal() == 2) { Destroy(); wxExit(); } #endif }
void wxLuaConsole::OnCloseWindow(wxCloseEvent&) { // Must NULL the console so nobody will try to still use it. // Using EVT_DESTROY in the app causes a segfault if this is deleted // in wxApp::OnExit() and though this is ugly, it works. if (m_wrapper) m_wrapper->SetConsole(NULL); Destroy(); if (m_exit_when_closed) wxExit(); }
void TestRunner::RunNextTest() { if (m_current_test < sizeof(tests)/sizeof(tests[0])) { std::cerr << "Executing test " << tests[m_current_test]->TestName() << std::endl; tests[m_current_test]->Init(this, m_controller, m_config_manager); tests[m_current_test]->Start(); } else { std::cerr << std::endl << std::endl; std::cerr << "Tests execution completed, executed " << m_current_test << " tests" << std::endl; std::cerr << Test::s_assertions_tested << " assertions tested of which " << Test::s_assertions_failed << " failed" << std::endl; wxExit(); } }
void FrameManager::OnClose(wxCloseEvent &event) { DrawFrame *frame = wxDynamicCast(event.GetEventObject(), DrawFrame); assert(frame != NULL); if (event.CanVeto()) { wxString msg; if (frames.Count() == 1) { msg = _("Do you want to close the application?"); } else msg = _("Do you want to close this window?"); int ret = wxMessageBox(msg, _("Question"), wxYES_NO, frame); if (ret != wxYES) { event.Veto(); return; } } size_t i; for (i = 0; i < frames.Count(); ++i) if (frames[i] == frame) break; assert(i < frames.Count()); int dn = frame->wxWindowBase::GetId(); int width, height; frame->GetSize(&width, &height); wxConfig::Get()->Write(wxString::Format(_T("DrawFrameWidth_%d"), dn), width); wxConfig::Get()->Write(wxString::Format(_T("DrawFrameHeight_%d"), dn), height); int x, y; frame->GetPosition(&x, &y); wxConfig::Get()->Write(wxString::Format(_T("DrawFrameX_%d"), dn), x); wxConfig::Get()->Write(wxString::Format(_T("DrawFrameY_%d"), dn), y); frame->SaveLayout(); frame->Destroy(); frames.RemoveAt(i); if (frames.Count() == 0) { wxConfig::Get()->Flush(); wxExit(); } }
void dlgMain::OnRefreshServer(wxCommandEvent &event) { // prevent reentrancy static wxRecursionGuardFlag s_rgf; wxRecursionGuard recursion_guard(s_rgf); if (recursion_guard.IsInside()) return; if (GetThread() && GetThread()->IsRunning()) return; if (!m_LstCtrlServers->GetItemCount() || !m_LstCtrlServers->GetSelectedItemCount()) return; m_LstCtrlPlayers->DeleteAllItems(); wxInt32 listindex = m_LstCtrlServers->GetNextItem(-1, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED); wxListItem item; item.SetId(listindex); item.SetColumn(7); item.SetMask(wxLIST_MASK_TEXT); m_LstCtrlServers->GetItem(item); wxInt32 arrayindex = FindServer(item.GetText()); if (arrayindex == -1) return; TotalPlayers -= QServer[arrayindex].info.numplayers; mtcs_Request.Signal = mtcs_getsingleserver; mtcs_Request.ServerListIndex = listindex; mtcs_Request.Index = arrayindex; // Create monitor thread and run it if (this->wxThreadHelper::Create() != wxTHREAD_NO_ERROR) { wxMessageBox(_T("Could not create monitor thread!"), _T("Error"), wxOK | wxICON_ERROR); wxExit(); } GetThread()->Run(); }
QueryThread::QueryThread(wxEvtHandler *EventHandler) : wxThread(wxTHREAD_JOINABLE), m_EventHandler(EventHandler) { if (Create() != wxTHREAD_NO_ERROR) { wxMessageBox(_T("Could not create worker thread!"), _T("Error"), wxOK | wxICON_ERROR); wxExit(); } m_Condition = new wxCondition(m_Mutex); Run(); }
void EkstraktorMainWindow::onClose(wxCloseEvent &event) { if (event.CanVeto() && parlist->IsModified() && !parlist->IsEmpty()) { if (wxMessageBox(_("Current parameters list is not saved.\nExit anyway?"), _("Parameters list modified"), wxICON_QUESTION | wxYES_NO) == wxNO) { event.Veto(); return; } } delete parlist; wxExit(); }
void MyApp::OnFileMenu(wxCommandEvent &ev) { switch (ev.GetId()) { case wxMaximaFrame::menu_new_id: case ToolBar::tb_new: case wxMaxima::mac_newId: // Mac computers insist that all instances of a new application need to share // the same process. On all other OSes we create a separate process for each // window: This way if one instance of wxMaxima crashes all the other instances // are still alive. #if defined __WXMAC__ NewWindow(); #else // NewWindow(); wxExecute(wxT("\"")+wxStandardPaths::Get().GetExecutablePath()+wxT("\"")); #endif break; case wxMaxima::mac_openId: { wxString file = wxFileSelector(_("Open"), wxEmptyString, wxEmptyString, wxEmptyString, _("wxMaxima document (*.wxm, *.wxmx)|*.wxm;*.wxmx"), wxFD_OPEN); if (file.Length() > 0) NewWindow(file); } break; case wxID_EXIT: { bool quit = true; std::list<wxMaxima *>::iterator it=m_topLevelWindows.begin(); while(it != m_topLevelWindows.end()) { if (!(*it)->Close()) { quit = false; break; } } if (quit) wxExit(); } break; } }
void MerryTaskBarIcon::onPopMenu(wxCommandEvent& e) { switch(e.GetId()) { case MENU_ITEM_ABOUT: new MerryInformationDialog(wxT("关于 ALMRun"),wxString::Format("version " VERSION_STR " --- http://ALMRun.chenall.net\r\n修改自(merry SVN R:98 http://name5566.com)\r\n编译时间:%s %s",__DATE__,__TIME__)); break; case MENU_ITEM_SHOW: ::wxGetApp().GetFrame().Show(); break; case MENU_ITEM_OPEN_CONFIG: ::wxGetApp().GetFrame().OpenConfigDir(); break; case MENU_ITEM_RECONFIG: ::wxGetApp().GetFrame().NewConfig(); break; case MENU_ITEM_EXIT: //wxGetApp().ExitMainLoop(); // insert your code here //ExitProcess(0); // this->EndModal(true); //::PostMessage((HWND__ *)::wxGetApp().GetFrame().GetHandle(),WM_CLOSE,0,0); //::PostMessage((HWND__ *)::wxGetApp().GetFrame().GetHandle(),WM_QUIT,0,0); //exit(0); wxExit(); break; case MENU_ITEM_EXIT1: PostMessage((HWND__ *)::wxGetApp().GetFrame().GetHandle(),WM_CLOSE,0,0); break; #ifdef _ALMRUN_CONFIG_H_ case MENU_ITEM_GUI_CONFIG: g_config->GuiConfig(); break; #endif//#ifdef _ALMRUN_CONFIG_H_ #ifdef _CMDMGR_H_ case MENU_ITEM_CMDMGR: cmdMgr *dlg = new cmdMgr(0); dlg->ShowModal(); dlg->Destroy(); ::wxGetApp().GetFrame().NewConfig(); break; #endif } }
void PathUtilDlg::ChooseDirectory(wxWindow* parent, const wxString title, wxTextCtrl* receiver ) { if (!receiver) { wxMessageBox(_T("NULL parameter")); wxExit(); } wxString dirHome; wxGetHomeDir(&dirHome); wxDirDialog dialog(parent, title, dirHome, wxDD_DEFAULT_STYLE & ~wxDD_DIR_MUST_EXIST); if (dialog.ShowModal() == wxID_OK) { if (receiver->GetWindowStyleFlag() & wxTE_MULTILINE) { wxString old_value = receiver->GetValue(); boost::char_separator<TCHAR> sep( _T("\n")); tchar_string str = old_value.c_str(); tokenizer tokens(str, sep); tokenizer::iterator tok_iter = tokens.begin(); tchar_string one_line; while(tok_iter!=tokens.end()) { one_line = *tok_iter++; if (dialog.GetPath() == one_line) return; } if (old_value.length()) { receiver->AppendText(wxT("\r\n")); } receiver->AppendText(dialog.GetPath()); } else { receiver->SetValue(dialog.GetPath()); } } }
// Posts a message from the main thread to the monitor thread bool dlgMain::MainThrPostEvent(mtcs_t CommandSignal, wxInt32 Index, wxInt32 ListIndex) { if (GetThread() && GetThread()->IsRunning()) return false; // Create monitor thread if (this->wxThreadHelper::Create() != wxTHREAD_NO_ERROR) { wxMessageBox(_T("Could not create monitor thread!"), _T("Error"), wxOK | wxICON_ERROR); wxExit(); } mtcs_Request.Signal = CommandSignal; mtcs_Request.Index = Index; mtcs_Request.ServerListIndex = ListIndex; GetThread()->Run(); return true; }
bool cashierApp::OnInit() { try { flog.reset(new file_log_t("cashier.log", 10)); *flog << "start cashier"; } catch (...) { wxMessageBox(_("can't create log file")); wxExit(); return false; } try { *flog << "create xml_config_t"; config.reset(new xml_config_t("cashier.xml")); *flog << "successful"; if (config->get("app", "frac") == "") config->set("app", "frac", "2"); } catch (exception_t& ex) { *flog << ex.comp_message(); wxMessageBox(to_uc(ex.user_message())); wxExit(); return false; } catch (std::exception &ex) { *flog << LLOCATION; *flog << ex.what(); wxMessageBox(to_uc(ex.what())); wxExit(); return false; } catch (...) { *flog << "can't create config file"; wxMessageBox(_("can't create config file")); wxExit(); return false; } try { *flog << "create bag_spooler_t"; std::string server = config->get("bag_spooler", "server"); if (server == "") server = "cafeserv.ksi.ru"; bag_spooler.reset(new bag_spooler_t(server)); *flog << "successful"; } catch (std::exception& ex) { *flog << LLOCATION; *flog << ex.what(); wxMessageBox(to_uc(ex.what())); wxExit(); return false; } catch (...) { *flog << "can't create bag_spooler"; wxMessageBox(_("can't create bag_spooler")); wxExit(); return false; } try { *flog << "create xml_lang_t"; if (config->get("locale", "enable") == "1") { locale.reset(new ksi_cafe::xml_lang_t(config->get("locale", "file"), config->get("locale", "name"), "cashier")); shared_locale.reset(new ksi_cafe::xml_lang_t(config->get("locale", "file"), config->get("locale", "name"), "shared")); lang = 2; } else { locale.reset(new ksi_cafe::xml_lang_t()); shared_locale.reset(new ksi_cafe::xml_lang_t()); lang = 1; } *flog << "successful"; } catch (exception_t& ex) { *flog << ex.what(); locale.reset(new ksi_cafe::xml_lang_t()); wxMessageBox(to_uc(ex.user_message())); } catch (std::exception& ex) { *flog << LLOCATION; *flog << ex.what(); locale.reset(new ksi_cafe::xml_lang_t()); wxMessageBox(to_uc(ex.what())); } catch (...) { *flog << ERROR_IN_LOCATION; wxMessageBox(to_uc(ERROR_IN_LOCATION)); wxExit(); return false; } *flog << "app_version = " + version::version; wx_window_ptr<auth_f> auth (new auth_f(0, to_uc(version::product) + _(" v") + to_uc(version::version), locale->get("auth_f", "login_message_lb1", "Swipe your magnetic card to sign in"), locale->get("auth_f", "login_message_lb2", "Type your login and password"))); auth->set_login(config->get("last_auth", "login")); auth->set_host(config->get("last_auth", "host")); wxIcon cashierIco; cashierIco.CopyFromBitmap(CashierBitmapsFunc(0)); auth->SetIcon(cashierIco); // To Set App Icon wxBitmap splash_bitmap = CashierBitmapsFunc(8); { wxMemoryDC splashDC; splashDC.SelectObject(splash_bitmap); wxString text = _("v")+to_uc(version::version); int text_len = splashDC.GetTextExtent(text).x; splashDC.DrawText(text, splashDC.GetSize().GetWidth()-text_len - 20, splashDC.GetSize().GetHeight()/2); splashDC.SelectObject( wxNullBitmap ); } wx_window_ptr<wxSplashScreen> splash (new wxSplashScreen(splash_bitmap, wxSPLASH_CENTRE_ON_SCREEN|wxSPLASH_NO_TIMEOUT, 6000, NULL, -1, wxDefaultPosition, wxDefaultSize, wxSIMPLE_BORDER)); for (;;) { splash->Hide(); int result = auth->ShowModal(); if (result == wxID_OK) { splash->Show(); std::auto_ptr<ksi_client::oracle_session_i> session_ptr = ksi_client::create_session(); try { session_ptr->connect(auth->login_mb(), auth->password_mb(), auth->host_mb(), auth->sid_mb(), auth->port_mb()); server_host = auth->host_mb() + ":" + boost::lexical_cast<std::string>(auth->port_mb()) + ":" + auth->sid_mb(); ksi_cafe::session.reset(session_ptr.release()); break; } catch (ksi_client::connection_problem_exception& ex) { *flog << ex.what(); wxMessageBox(to_uc(ex.what())); } catch (ksi_client::db_exception& ex) { *flog << ex.what(); wxMessageBox(shared_locale->get("db_exception", ex.userFriendly().first, ex.userFriendly().second)); } catch (ksi_client::ksi_exception& ex) { *flog << ex.what(); wxMessageBox(to_uc(ex.what())); } catch (std::exception& ex) { *flog << LLOCATION; *flog << ex.what(); wxMessageBox(to_uc(ex.what())); } catch (...) { *flog << ERROR_IN_LOCATION; wxMessageBox(to_uc(ERROR_IN_LOCATION)); } } else if (result == wxID_CANCEL) { splash->Close(); return true; } } *flog << "Current USER = "******"last_auth", "login", auth->login_mb()); config->set("last_auth", "host", server_host); auth.reset(); if (config->get("ext", "mode") == "1") { try { *flog << "ext_mode=1"; std::vector<std::string> mac_vec = get_mac(); std::auto_ptr<ksi_client::oracle_query_i> query = ksi_cafe::session->create_query(); int successful = -1; std::string mac = ""; for (size_t i=0; i<mac_vec.size(); ++i) { query->create_statement ( "select ksi.SEANCE_EXIST('" + mac_vec[i] + "') from dual" ); query->execute_statement(); int res = static_cast<int>(boost::get<double>(query->get(0))); if (res == 0) { // not exist mac = mac_vec[i]; successful = 0; break; } else if (res == 1) { // exist mac = mac_vec[i]; successful = 1; break; } else if (res == -1) { // error successful = -1; } } if (successful == 0 && mac != "") { // not exist *flog << "seance not exist"; std::auto_ptr<ksi_client::oracle_query_i> query = ksi_cafe::session->create_query(); query->create_statement ( "begin ksi.CREATE_SESSION('" + mac + "'); end;" ); query->execute_statement(); /*begin work*/ if ((to_uc(config->get("printer", "source")).MakeUpper() == _("LOCAL")) && (to_uc(config->get("printer", "command_set")).MakeUpper() == _("FISCAL REGISTRAR"))) { //com_t com(config->get("printer", "port"), boost::lexical_cast<int>(config->get("printer", "baud_rate")), 3); //fiscal::registrator_t registrar(com); ksi_cafe::session->commit(); } else wxMessageBox(_("Bad config")); ksi_cafe::session->rollback(); /*end work*/ } else if (successful = 1 && mac != "") { // exist *flog << "seance exist"; } else { // error *flog << "seace error"; wxMessageBox(_("This terminal is not registered on the shift or the shift is not running.")); wxExit(); return false; } } catch (exception_t& ex) { *flog << LLOCATION; *flog << ex.comp_message(); bag_spooler->send_bag(bag_record_t(0, app_id, version::version, ex.what())); wxMessageBox(to_uc(ex.comp_message())); wxExit(); return false; } catch (ksi_client::db_exception& ex) { *flog << LLOCATION; *flog << ex.what(); bag_spooler->send_bag(bag_record_t(0, app_id, version::version, ex.what())); wxMessageBox(shared_locale->get("db_exception", ex.userFriendly().first, ex.userFriendly().second)); wxExit(); return false; } catch (ksi_client::ksi_exception& ex) { *flog << LLOCATION; *flog << ex.what(); bag_spooler->send_bag(bag_record_t(0, app_id, version::version, ex.what())); wxMessageBox(to_uc(ex.what())); wxExit(); return false; } catch (fiscal::exception& ex) { *flog << LLOCATION; *flog << ex.what(); bag_spooler->send_bag(bag_record_t(0, app_id, version::version, ex.what())); wxMessageBox(to_uc(ex.what())); wxExit(); return false; } catch (std::exception& ex) { *flog << LLOCATION; *flog << ex.what(); bag_spooler->send_bag(bag_record_t(0, app_id, version::version, ex.what())); wxMessageBox(to_uc(ex.what())); wxExit(); return false; } catch (...) { *flog << ERROR_IN_LOCATION; bag_spooler->send_bag(bag_record_t(0, app_id, version::version, ERROR_IN_LOCATION)); wxMessageBox(to_uc(ERROR_IN_LOCATION)); wxExit(); return false; } } try { cashier_f* cashier = new cashier_f(0); cashier->SetIcon(cashierIco); if (config->get("resolution", "stay_on_top") == "0" || to_uc(config->get("resolution", "stay_on_top")).MakeUpper() == _("OFF")) { } else { cashier->SetWindowStyle(wxSTAY_ON_TOP|wxTAB_TRAVERSAL); } if (config->get("resolution", "auto") == "1" || to_uc(config->get("resolution", "auto")).MakeUpper() == _("ON")) { cashier->ShowFullScreen(true); } else cashier->Show(); splash->Close(); } catch (exception_t& ex) { *flog << LLOCATION; *flog << ex.comp_message(); bag_spooler->send_bag(bag_record_t(0, app_id, version::version, ex.what())); wxMessageBox(to_uc(ex.user_message())); wxExit(); return false; } catch (ksi_client::ksi_exception& ex) { *flog << LLOCATION; *flog << ex.what(); bag_spooler->send_bag(bag_record_t(0, app_id, version::version, ex.what())); wxMessageBox(to_uc(ex.what())); wxExit(); return false; } catch (std::exception& ex) { *flog << LLOCATION; *flog << ex.what(); bag_spooler->send_bag(bag_record_t(0, app_id, version::version, ex.what())); wxMessageBox(to_uc(ex.what())); wxExit(); return false; } catch (...) { *flog << ERROR_IN_LOCATION; bag_spooler->send_bag(bag_record_t(0, app_id, version::version, ERROR_IN_LOCATION)); wxMessageBox(to_uc(ERROR_IN_LOCATION)); wxExit(); return false; } splash->Close(); return true; }
void MainFrameDerived::ExitClicked( wxCommandEvent& event ) { wxExit(); }
void ClickablePanel::close_game_bmpButtonClicked(wxCommandEvent & event){ wxExit(); }
// Main window creation dlgMain::dlgMain(wxWindow* parent, wxWindowID id) { launchercfg_s.get_list_on_start = 1; launchercfg_s.show_blocked_servers = 1; launchercfg_s.wad_paths = wxGetCwd(); launchercfg_s.odamex_directory = wxGetCwd(); wxXmlResource::Get()->LoadFrame(this, parent, _T("dlgMain")); // Set up icons, this is a hack because wxwidgets does not have an xml // handler for wxIconBundle :( wxIconBundle IconBundle; IconBundle.AddIcon(wxXmlResource::Get()->LoadIcon(_T("icon16x16x32"))); IconBundle.AddIcon(wxXmlResource::Get()->LoadIcon(_T("icon32x32x32"))); IconBundle.AddIcon(wxXmlResource::Get()->LoadIcon(_T("icon48x48x32"))); IconBundle.AddIcon(wxXmlResource::Get()->LoadIcon(_T("icon16x16x8"))); IconBundle.AddIcon(wxXmlResource::Get()->LoadIcon(_T("icon32x32x8"))); SetIcons(IconBundle); m_LstCtrlServers = wxDynamicCast(FindWindow(Id_LstCtrlServers), wxAdvancedListCtrl); m_LstCtrlPlayers = wxDynamicCast(FindWindow(Id_LstCtrlPlayers), wxAdvancedListCtrl); SetupServerListColumns(m_LstCtrlServers); SetupPlayerListHeader(m_LstCtrlPlayers); // spectator state. m_LstCtrlPlayers->AddImageSmall(wxArtProvider::GetBitmap(wxART_FIND).ConvertToImage()); // Load configuration wxFileConfig ConfigInfo; wxInt32 ServerListSortOrder, ServerListSortColumn; wxInt32 PlayerListSortOrder, PlayerListSortColumn; ConfigInfo.Read(_T("ServerListSortOrder"), &ServerListSortOrder, 1); ConfigInfo.Read(_T("ServerListSortColumn"), &ServerListSortColumn, 0); m_LstCtrlServers->SetSortColumnAndOrder(ServerListSortColumn, ServerListSortOrder); ConfigInfo.Read(_T("PlayerListSortOrder"), &PlayerListSortOrder, 1); ConfigInfo.Read(_T("PlayerListSortColumn"), &PlayerListSortColumn, 0); m_LstCtrlPlayers->SetSortColumnAndOrder(PlayerListSortColumn, PlayerListSortOrder); wxInt32 WindowWidth, WindowHeight; ConfigInfo.Read(_T("MainWindowWidth"), &WindowWidth, GetSize().GetWidth()); ConfigInfo.Read(_T("MainWindowHeight"), &WindowHeight, GetSize().GetHeight()); SetSize(WindowWidth, WindowHeight); // set up the master server information MServer = new MasterServer; MServer->AddMaster(_T("master1.odamex.net"), 15000); MServer->AddMaster(_T("voxelsoft.com"), 15000); /* Init sub dialogs and load settings */ config_dlg = new dlgConfig(&launchercfg_s, this); server_dlg = new dlgServers(MServer, this); /* Get the first directory for wad downloading */ wxInt32 Pos = launchercfg_s.wad_paths.Find(wxT(';'), false); wxString FirstDirectory = launchercfg_s.wad_paths.Mid(0, Pos); OdaGet = new frmOdaGet(this, -1, FirstDirectory); QServer = NULL; // Create monitor thread and run it if (this->wxThreadHelper::Create() != wxTHREAD_NO_ERROR) { wxMessageBox(_T("Could not create monitor thread!"), _T("Error"), wxOK | wxICON_ERROR); wxExit(); } GetThread()->Run(); // get master list on application start if (launchercfg_s.get_list_on_start) { wxCommandEvent event(wxEVT_COMMAND_TOOL_CLICKED, Id_MnuItmGetList); wxPostEvent(this, event); } }
bool CEditorApp::OnInit() { plClearLog(EDITOR_LOG); plWriteLog(EDITOR_LOG, "Initializing engine interface...\n"); EngineInterface_Load(); g_apptitle = EDITOR_TITLE " (" EDITOR_VERSION ")"; wxImage::AddHandler(new wxPNGHandler); wxImage::AddHandler(new wxGIFHandler); wxImage::AddHandler(new wxICOHandler); bSplashScreen.LoadFile("resource/splash-editor.png", wxBITMAP_TYPE_PNG); bSmallMDL.LoadFile("resource/icon-mdl-small.png", wxBITMAP_TYPE_PNG); bSmallAuto.LoadFile("resource/view-auto.png", wxBITMAP_TYPE_PNG); bSmallWAD.LoadFile("resource/icon-wad-small.png", wxBITMAP_TYPE_PNG); bSmallPrefIcon.LoadFile(PATH_16ICONS"actions/configure.png", wxBITMAP_TYPE_PNG); smallDocumentNew.LoadFile(PATH_16ICONS"actions/document-new.png", wxBITMAP_TYPE_PNG); smallDocumentOpen.LoadFile(PATH_16ICONS"actions/document-open.png", wxBITMAP_TYPE_PNG); smallDocumentSave.LoadFile(PATH_16ICONS"actions/document-save.png", wxBITMAP_TYPE_PNG); smallDocumentClose.LoadFile(PATH_16ICONS"actions/document-close.png", wxBITMAP_TYPE_PNG); smallDocumentSaveAs.LoadFile(PATH_16ICONS"actions/document-save-as.png", wxBITMAP_TYPE_PNG); iconDocumentUndo.LoadFile(PATH_16ICONS"actions/edit-undo.png", wxBITMAP_TYPE_PNG); iconDocumentRedo.LoadFile(PATH_16ICONS"actions/edit-redo.png", wxBITMAP_TYPE_PNG); iconMediaPause.LoadFile(PATH_16ICONS"actions/media-playback-pause.png", wxBITMAP_TYPE_PNG); iconMediaPlay.LoadFile(PATH_16ICONS"actions/media-playback-start.png", wxBITMAP_TYPE_PNG); iconDocumentRefresh.LoadFile(PATH_16ICONS"actions/view-refresh.png", wxBITMAP_TYPE_PNG); iconShapeCube.LoadFile("resource/shape-cube.png", wxBITMAP_TYPE_PNG); iconShapeSphere.LoadFile("resource/shape-sphere.png", wxBITMAP_TYPE_PNG); bSmallPlaneIcon.LoadFile("resource/shape-plane.png", wxBITMAP_TYPE_PNG); iconScriptEdit.LoadFile(PATH_16ICONS"apps/accessories-text-editor.png", wxBITMAP_TYPE_PNG); smallTransform.LoadFile(PATH_16ICONS"actions/transform-move.png", wxBITMAP_TYPE_PNG); smallApplicationExit.LoadFile(PATH_16ICONS"actions/application-exit.png", wxBITMAP_TYPE_PNG); plWriteLog(EDITOR_LOG, "Creating main frame...\n"); editor_frame = new CEditorFrame(g_apptitle, wxPoint(50, 50), wxSize(1024, 768)); if (!editor_frame) { EngineInterface_Unload(); wxMessageBox("Failed to create main frame!", EDITOR_TITLE" Error"); wxExit(); } if (!engine->Initialize(argc, argv, true)) { EngineInterface_Unload(); wxMessageBox("Failed to initialize engine!", EDITOR_TITLE" Error"); wxExit(); } engine->MaterialEditorInitialize(); sEditorMaterialPath = engine->GetMaterialPath(); editor_frame->Initialize(); plWriteLog(EDITOR_LOG, "Starting main loop...\n"); // Start rendering. editor_frame->StartEngineLoop(); return true; }
bool wxLuaDebugTarget::DebugHook(int event) { bool fWait = false; m_fStopped = true; int lineNumber = 0; wxString fileName; if (!(m_forceBreak && m_resetRequested)) { lua_Debug luaDebug = INIT_LUA_DEBUG; lua_getstack(m_wxlState.GetLuaState(), 0, &luaDebug); lua_getinfo(m_wxlState.GetLuaState(), "Sln", &luaDebug); lineNumber = luaDebug.currentline - 1; fileName = lua2wx(luaDebug.source); if (!fileName.IsEmpty() && (fileName[0] == wxT('@'))) fileName = fileName.Mid(1); } if (m_forceBreak) { if (m_resetRequested) { fWait = true; m_fExiting = true; wxExit(); } if (!m_fExiting) { if (NotifyBreak(fileName, lineNumber)) fWait = true; } } else { if (event == LUA_HOOKCALL) // call m_nFramesUntilBreak++; else if ((event == LUA_HOOKRET) || (event == LUA_HOOKTAILRET)) // return { if (m_nFramesUntilBreak > 0) m_nFramesUntilBreak--; } else if (event == LUA_HOOKLINE) // line { switch (m_nextOperation) { case DEBUG_STEP: { if (NotifyBreak(fileName, lineNumber)) fWait = true; break; } case DEBUG_STEPOVER: { if ((m_nFramesUntilBreak == 0) && NotifyBreak(fileName, lineNumber)) fWait = true; break; } case DEBUG_GO: default: { if (AtBreakPoint(fileName, lineNumber) && NotifyBreak(fileName, lineNumber)) fWait = true; break; } } } } if (fWait) { // release the critical section so // the other thread can access LUA LeaveLuaCriticalSection(); // Wait for a command m_debugCondition.Wait(); // acquire the critical section again EnterLuaCriticalSection(); } m_fStopped = false; return fWait; }
void retcon::OnQuitMsg(wxCommandEvent &event) { LogMsgFormat(LOGT::OTHERTRACE, "retcon::OnQuitMsg, about to call wxExit(), %d termination requests, %d mainframes, top win: %p, popup recursion: %d", terms_requested, mainframelist.size(), GetTopWindow(), popuprecursion); wxExit(); }
void QuitAudacity(bool bForce) { if (gIsQuitting) return; gIsQuitting = true; if(bForce) { wxMessageBox(_("WARNING: You may be prompted to save your work. Clicking cancel will have the same effect as clicking no.")); } // Try to close each open window. If the user hits Cancel // in a Save Changes dialog, don't continue. // BG: unless force is true SaveWindowSize(); // BG: Are there any projects open? if(!gAudacityProjects.IsEmpty()) { size_t len = gAudacityProjects.Count(); for (size_t i = 0; i < len; i++) { if(bForce) { gAudacityProjects[i]->Close(true); } else { if (!gAudacityProjects[i]->Close()){ gIsQuitting = false; return; } } } } if (gFreqWindow) gFreqWindow->Destroy(); if (gParentFrame) gParentFrame->Destroy(); gFreqWindow = NULL; gParentFrame = NULL; // Delete all the toolbars... for(int i=0;i<nToolBars;i++) { if( *gToolBarStubArray[i] ) { delete *gToolBarStubArray[i]; *gToolBarStubArray[i]=NULL; } } //Delete the clipboard AudacityProject::DeleteClipboard(); QuitHelp(); if(bForce) { wxExit(); } }
void Application::exit(int returncode) { SLM_WARN_IF("returncode is actually ignored in fwGuiWx", returncode != 0); wxExit(); }
virtual bool OnInit() { SetAppName("codelite-terminal"); wxFileName configDir(wxStandardPaths::Get().GetUserDataDir(), ""); configDir.Mkdir(wxS_DIR_DEFAULT, wxPATH_MKDIR_FULL); m_persistency = new MyPersistenceManager(); wxPersistenceManager::Set(*m_persistency); wxTerminalOptions& m_options = wxTerminalOptions::Get(); // m_persistencManager = new clPersistenceManager(); // wxPersistenceManager::Set(*m_persistencManager); #ifdef __WXMSW__ typedef BOOL WINAPI (*SetProcessDPIAwareFunc)(); HINSTANCE user32Dll = LoadLibrary(L"User32.dll"); if(user32Dll) { SetProcessDPIAwareFunc pFunc = (SetProcessDPIAwareFunc)GetProcAddress(user32Dll, "SetProcessDPIAware"); if(pFunc) { pFunc(); } FreeLibrary(user32Dll); } #endif wxCmdLineParser parser(wxApp::argc, wxApp::argv); parser.SetDesc(cmdLineDesc); const wxArrayString& argv = wxApp::argv.GetArguments(); for(const wxString& arg : argv) { if(arg.StartsWith("--wait")) { m_options.SetWaitOnExit(true); } else if(arg.StartsWith("--help")) { // Print usage and exit std::cout << parser.GetUsageString() << std::endl; wxExit(); } else if(arg.StartsWith("--title")) { wxString title = arg.AfterFirst('='); m_options.SetTitle(title); } else if(arg.StartsWith("--print-tty")) { m_options.SetPrintTTY(true); wxString ttyfile = arg.AfterFirst('='); m_options.SetTtyfile(ttyfile); } else if(arg.StartsWith("--working-directory")) { wxString wd = arg.AfterFirst('='); m_options.SetWorkingDirectory(wd); } else if(arg.StartsWith("--command")) { wxString cmd = arg.AfterFirst('='); m_options.SetCommand(cmd); } else if(arg.StartsWith("--file")) { wxString cmdfile = arg.AfterFirst('='); m_options.SetCommandFromFile(cmdfile); } else if(arg.StartsWith("--log")) { wxString logfile = arg.AfterFirst('='); m_options.SetLogfile(logfile); } } // Add the common image handlers wxImage::AddHandler(new wxPNGHandler); wxImage::AddHandler(new wxJPEGHandler); MainFrame* mainFrame = new MainFrame(NULL); SetTopWindow(mainFrame); return GetTopWindow()->Show(); }
void bmx_wxexit() { wxExit(); }
bool MyApp::OnInit() { m_frame = NULL; // atexit(Cleanup_Static); int lang = wxLANGUAGE_UNKNOWN; bool batchmode = false; wxCmdLineParser cmdLineParser(argc, argv); static const wxCmdLineEntryDesc cmdLineDesc[] = { { wxCMD_LINE_SWITCH, "v", "version", "Output the version info" }, /* Usually wxCMD_LINE_OPTION_HELP is used with the following option, but that displays a message * using a own window and we want the message on the command line. If a user enters a command * line option, he expects probably a answer just on the command line... */ { wxCMD_LINE_SWITCH, "h", "help", "show this help message", wxCMD_LINE_VAL_NONE}, { wxCMD_LINE_OPTION, "o", "open", "open a file" }, { wxCMD_LINE_SWITCH, "b", "batch","run the file and exit afterwards. Halts on questions and stops on errors." }, #if defined __WXMSW__ { wxCMD_LINE_OPTION, "f", "ini", "open an input file" }, #endif { wxCMD_LINE_PARAM, NULL, NULL, "input file", wxCMD_LINE_VAL_STRING, wxCMD_LINE_PARAM_OPTIONAL }, { wxCMD_LINE_NONE } }; cmdLineParser.SetDesc(cmdLineDesc); cmdLineParser.Parse(); wxString ini, file; #if defined __WXMSW__ if (cmdLineParser.Found(wxT("f"),&ini)) wxConfig::Set(new wxFileConfig(ini)); else wxConfig::Set(new wxConfig(wxT("wxMaxima"))); #else wxConfig::Set(new wxConfig(wxT("wxMaxima"))); #endif wxImage::AddHandler(new wxPNGHandler); wxImage::AddHandler(new wxXPMHandler); wxImage::AddHandler(new wxJPEGHandler); wxFileSystem::AddHandler(new wxZipFSHandler); Dirstructure dirstructure; wxConfigBase *config = wxConfig::Get(); config->Read(wxT("language"), &lang); if (lang == wxLANGUAGE_UNKNOWN) lang = wxLocale::GetSystemLanguage(); { wxLogNull disableErrors; m_locale.Init(lang); } #if defined (__WXMSW__) wxSetEnv(wxT("LANG"), m_locale.GetName()); if (!wxGetEnv(wxT("BUILD_DIR"), NULL)) wxSetWorkingDirectory(wxPathOnly(wxString(argv[0]))); /* Add private jsMath fonts, if they exist */ if (wxFileExists("fonts/jsMath-cmex10.ttf")) AddFontResource(wxT("fonts/jsMath-cmex10.ttf")); if (wxFileExists("fonts/jsMath-cmsy10.ttf")) AddFontResource(wxT("fonts/jsMath-cmsy10.ttf")); if (wxFileExists("fonts/jsMath-cmr10.ttf")) AddFontResource(wxT("fonts/jsMath-cmr10.ttf")); if (wxFileExists("fonts/jsMath-cmmi10.ttf")) AddFontResource(wxT("fonts/jsMath-cmmi10.ttf")); if (wxFileExists("fonts/jsMath-cmti10.ttf")) AddFontResource(wxT("fonts/jsMath-cmti10.ttf")); #endif m_locale.AddCatalogLookupPathPrefix(dirstructure.LocaleDir()); m_locale.AddCatalog(wxT("wxMaxima")); m_locale.AddCatalog(wxT("wxMaxima-wxstd")); #if defined __WXMAC__ wxString path; wxGetEnv(wxT("PATH"), &path); wxSetEnv(wxT("PATH"), path << wxT(":/usr/local/bin")); #endif #if defined (__WXMAC__) wxApp::SetExitOnFrameDelete(false); wxMenuBar *menuBar = new wxMenuBar; wxMenu *fileMenu = new wxMenu; fileMenu->Append(wxMaxima::mac_newId, _("&New\tCtrl-N")); fileMenu->Append(wxMaxima::mac_openId, _("&Open\tCtrl-O")); menuBar->Append(fileMenu, _("File")); wxMenuBar::MacSetCommonMenuBar(menuBar); Connect(wxMaxima::mac_newId, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(MyApp::OnFileMenu)); Connect(wxMaxima::mac_openId, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(MyApp::OnFileMenu)); Connect(wxID_EXIT, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(MyApp::OnFileMenu)); #endif if (cmdLineParser.Found(wxT("v"))) { std::cout<<"wxMaxima "; std::cout << VERSION; std::cout<<"\n"; wxExit(); } if (cmdLineParser.Found(wxT("h"))) { std::cout<<"A feature-rich graphical user interface for the computer algebra system maxima\n"; std::cout<<cmdLineParser.GetUsageString(); wxExit(); } if (cmdLineParser.Found(wxT("b"))) { batchmode = true; } if (cmdLineParser.Found(wxT("o"), &file)) { wxFileName FileName=file; FileName.MakeAbsolute(); wxString CanonicalFilename=FileName.GetFullPath(); NewWindow(wxString(CanonicalFilename),batchmode); return true; } else { if (cmdLineParser.GetParamCount()>0) { wxFileName FileName=cmdLineParser.GetParam(); FileName.MakeAbsolute(); wxString CanonicalFilename=FileName.GetFullPath(); NewWindow(CanonicalFilename,batchmode); } else NewWindow(); } return true; }
EWXWEXPORT(void,ELJApp_Exit)() { wxExit(); }