void SigUIFrame::m_installOnButtonClick( wxCommandEvent& WXUNUSED(event) ) { wxWakeUpIdle(); wxBeginBusyCursor(); m_panel_sigman->Disable(); wxFileName exec(wxStandardPaths::Get().GetExecutablePath()); m_siginst_process = new wxProcess(this); m_siginst_process->Redirect(); long pid = wxExecute("\"" + exec.GetFullPath() + "\" -i", wxEXEC_ASYNC | wxEXEC_NOHIDE, m_siginst_process); if (!pid) { wxLogError(_("Failed to reexecute self for installing the virus signatures!")); return; } m_siginst_process->SetPid(pid); wxOutputStream *out = m_siginst_process->GetOutputStream(); for (unsigned i=0;i<m_sig_candidates->GetCount();i++) { wxString str = m_sig_candidates->GetString(i) + "\n"; const char *s = str.mb_str(); if (*s) { out->Write(s, strlen(s)); } else { // see bb #2343 wxLogError(_("Filenames with non-ASCII characters not yet supported: %s"), str); return; } } m_siginst_process->CloseOutput(); wxWakeUpIdle(); }
void GUIThread::run_wx_function( Task t ) { boost::recursive_mutex::scoped_lock lock( mutex ); if ( sequence_number == 0 ) wxWakeUpIdle(); t.sequence = sequence_number++; tasks.push(t); have_task.notify_all(); }
void SigUIFrame::OnTerminateInstall(wxProcessEvent &event) { wxEndBusyCursor(); wxWakeUpIdle(); if (event.GetExitCode() == 0) { m_sig_candidates->Clear(); wxLogMessage(_("Successfully installed new virus signatures\n")); reload(); } else { bool had_errors = false; wxInputStream *err = m_siginst_process->GetErrorStream(); wxTextInputStream tis(*err); while (!err->Eof()) { wxString line = tis.ReadLine(); line.Trim(); if (!line.IsEmpty()) { wxLogWarning("%s", line); had_errors = true; } } if (had_errors) { wxLogError(_("Errors encountered during virus signature install")); } } delete m_siginst_process; m_panel_sigman->Enable(); }
bool wxGISMapView::CreateAndRunDrawThread(void) { wxCriticalSectionLocker locker(m_CritSect); #ifdef __WXGTK__ wxWakeUpIdle(); #endif if((GetThread() && GetThread()->IsRunning())|| !m_pGISDisplay->IsDerty()) return true; if (CreateThread(wxTHREAD_JOINABLE) != wxTHREAD_NO_ERROR) { wxLogError(_("Could not create the thread!")); return false; } if (GetThread()->Run() != wxTHREAD_NO_ERROR) { wxLogError(_("Could not run the thread!")); return false; } m_timer.Start(TM_REFRESH);//refresh time for map during drawing return true; }
//-------------------------------------------------------------------------------- void CIwASDAttrLayout::RefreshData(CIwASDData* data,bool base,bool Delete) { if (data==m_Data->m_File && base && Delete) m_Data=NULL; m_NeedReset=true; wxWakeUpIdle(); }
void meta_command(int what, wxe_data *sd) { if(what == PING_PORT) { wxWakeUpIdle(); } else { wxeMetaCommand Cmd(sd, what); wxTheApp->AddPendingEvent(Cmd); } }
void JMTimer::Notify() { jmlib->doJuggle(); if (canvas) canvas->Refresh(); #ifdef OPENGL_SUPPORT if (glCanvas) glCanvas->Refresh(); #endif wxWakeUpIdle(); wxYieldIfNeeded(); }
/* static */ void wxLog::OnLog(wxLogLevel level, const wxString& msg, const wxLogRecordInfo& info) { // fatal errors can't be suppressed nor handled by the custom log target // and always terminate the program if ( level == wxLOG_FatalError ) { wxSafeShowMessage(wxS("Fatal Error"), msg); #ifdef __WXWINCE__ ExitThread(3); #else abort(); #endif } wxLog *logger; #if wxUSE_THREADS if ( !wxThread::IsMain() ) { logger = wxThreadInfo.logger; if ( !logger ) { if ( ms_pLogger ) { // buffer the messages until they can be shown from the main // thread wxCriticalSectionLocker lock(GetBackgroundLogCS()); gs_bufferedLogRecords.push_back(wxLogRecord(level, msg, info)); // ensure that our Flush() will be called soon wxWakeUpIdle(); } //else: we don't have any logger at all, there is no need to log // anything return; } //else: we have a thread-specific logger, we can send messages to it // directly } else #endif // wxUSE_THREADS { logger = GetMainThreadActiveTarget(); if ( !logger ) return; } logger->CallDoLogNow(level, msg, info); }
void Host_Message(int Id) { if (Id == WM_USER_JOB_DISPATCH) { // Trigger a wxEVT_IDLE wxWakeUpIdle(); return; } wxCommandEvent event(wxEVT_HOST_COMMAND, Id); main_frame->GetEventHandler()->AddPendingEvent(event); }
void wxSettlersFrame::RestartEngine() { mRestartEngine = true; // Destroy the game menu if it exists. wxMenuBar* menu = GetMenuBar(); if(NULL != menu) { SetMenuBar(NULL); menu->Destroy(); } wxWakeUpIdle(); }
void meta_command(int what, wxe_data *sd) { if(what == PING_PORT) { erl_drv_mutex_lock(wxe_batch_locker_m); if(wxe_batch_caller > 0) { wxeCommand *Cmd = new wxeCommand(WXE_DEBUG_PING, NULL, 0, sd); wxe_batch->Append(Cmd); erl_drv_cond_signal(wxe_batch_locker_c); } wxWakeUpIdle(); erl_drv_mutex_unlock(wxe_batch_locker_m); } else { if(sd) { wxeMetaCommand Cmd(sd, what); wxTheApp->AddPendingEvent(Cmd); } } }
void MyClient::Notify() { // we shouldn't call wxIPC methods from here directly as we may be called // from inside an IPC call when using TCP/IP as the sockets are used in // non-blocking code and so can dispatch events, including the timer ones, // while waiting for IO and so starting another IPC call would result in // fatal reentrancies -- instead, just set a flag and perform the test // indicated by it later from our idle event handler MyClientTestFunc testfunc = NULL; switch ( m_step++ ) { case 0: testfunc = &MyClient::TestRequest; break; case 1: testfunc = &MyClient::TestPoke; break; case 2: testfunc = &MyClient::TestExecute; break; case 3: testfunc = &MyClient::TestStartAdvise; break; case 10: testfunc = &MyClient::TestStopAdvise; break; case 15: testfunc = &MyClient::TestDisconnect; // We don't need the timer any more, we're going to exit soon. Stop(); break; default: // No need to wake up idle handling. return; } m_tests.push_back(testfunc); wxWakeUpIdle(); }
void push_command(int op,char * buf,int len, wxe_data *sd) { /* fprintf(stderr, "Op %d %d [%ld] %d\r\n", op, (int) driver_caller(sd->port_handle), wxe_batch->size(), wxe_batch_caller),fflush(stderr); */ erl_drv_mutex_lock(wxe_batch_locker_m); wxe_queue->Add(op, buf, len, sd); if(wxe_needs_signal) { // wx-thread is waiting on batch end in cond_wait erl_drv_cond_signal(wxe_batch_locker_c); erl_drv_mutex_unlock(wxe_batch_locker_m); } else { // wx-thread is waiting gui-events erl_drv_mutex_unlock(wxe_batch_locker_m); wxWakeUpIdle(); } }
void ChaosConnectFrm::timer1Timer(wxTimerEvent& event) { /** * Event handler for the timer. * Determines if a chaos unit is connected and updates the status bar * Sends the connection information to the plots. * Collects more data if data collection is not paused. */ DisplayBifurcationSettings(); if(libchaos_isConnected() == true) { // Update the status bar statusBar->SetStatusText(wxT("Connected: Yes"),0); int value = libchaos_getMDACValue(); statusBar->SetStatusText(wxString::Format(wxT("MDAC Value: %d"), value), 1); statusBar->SetStatusText(wxString::Format(wxT("Resistance: %.2fk"), libchaos_mdacToResistance(value)/1000.0), 2); display1->getChaosPlot()->setDeviceStatus(true, value); display2->getChaosPlot()->setDeviceStatus(true, value); display3->getChaosPlot()->setDeviceStatus(true, value); display4->getChaosPlot()->setDeviceStatus(true, value); // Read data from the device if(ChaosSettings::Paused == false) { libchaos_readPlot(-1); } } else { statusBar->SetStatusText(wxT("Connected: No"),0); display1->getChaosPlot()->setDeviceStatus(false, 4095); display2->getChaosPlot()->setDeviceStatus(false, 4095); display3->getChaosPlot()->setDeviceStatus(false, 4095); display4->getChaosPlot()->setDeviceStatus(false, 4095); } if(ChaosSettings::Paused == false) { statusBar->SetStatusText(wxString::Format(wxT("Updating")), 4); } else { statusBar->SetStatusText(wxString::Format(wxT("PAUSED")), 4); } // Reset the interval if we need to if(timer1->GetInterval() != ChaosSettings::UpdatePeriod) { timer1->Start(ChaosSettings::UpdatePeriod); } wxWakeUpIdle(); }
void SigUIFrame::m_deleteOnButtonClick( wxCommandEvent& WXUNUSED(event) ) { wxArrayInt selections; int n = m_installed_sigs->GetSelections(selections); while ( n > 0 ) { wxString file = m_installed_sigs->GetString(selections[--n]); if (file.CmpNoCase("daily.cvd") == 0 || file.CmpNoCase("daily.cld") == 0) { wxLogError(_("daily.cvd and daily.cld cannot be removed!")); continue; } wxString msg; msg.Printf(_("Are you sure you want to delete %s?"), file); int answer = wxMessageBox(msg, _("Delete virus signature database"), wxYES_NO | wxCANCEL | wxNO_DEFAULT | wxICON_QUESTION, this); if (answer == wxCANCEL) break; if (answer != wxYES) continue; if (file.AfterLast('.').CmpNoCase("cvd") == 0 || file.AfterLast('.').CmpNoCase("cld") == 0) { msg.Printf(_("This is an important database file, managed by freshclam.\nAre you sure you want to delete %s?"), file); answer = wxMessageBox(msg, _("Delete important virus signature database"), wxYES_NO | wxCANCEL | wxNO_DEFAULT | wxICON_QUESTION, this); if (answer == wxCANCEL) break; if (answer != wxYES) continue; } wxFileName filepath(GetExecPath(), file); if (!wxRemoveFile(filepath.GetFullPath())) { wxLogError(_("Can't remove file %s"), filepath.GetFullPath()); } else reload(); } wxWakeUpIdle(); }
void push_command(int op,char * buf,int len, wxe_data *sd) { // fprintf(stderr, "Op %d %d\r\n", op, (int) driver_caller(sd->port)),fflush(stderr); wxeCommand *Cmd = new wxeCommand(op, buf, len, sd); erl_drv_mutex_lock(wxe_batch_locker_m); wxe_batch->Append(Cmd); if(wxe_batch_caller > 0) { // wx-thread is waiting on batch end in cond_wait erl_drv_cond_signal(wxe_batch_locker_c); } else { // wx-thread is waiting gui-events if(op == WXE_BATCH_BEGIN) { wxe_batch_caller = 1; } erl_drv_cond_signal(wxe_batch_locker_c); wxWakeUpIdle(); } erl_drv_mutex_unlock(wxe_batch_locker_m); }
void meta_command(int what, wxe_data *sd) { if(what == PING_PORT && wxe_status == WXE_INITIATED) { erl_drv_mutex_lock(wxe_batch_locker_m); if(wxe_needs_signal) { wxe_queue->Add(WXE_DEBUG_PING, NULL, 0, sd); erl_drv_cond_signal(wxe_batch_locker_c); } wxWakeUpIdle(); erl_drv_mutex_unlock(wxe_batch_locker_m); } else { if(sd && wxe_status == WXE_INITIATED) { wxeMetaCommand Cmd(sd, what); wxTheApp->AddPendingEvent(Cmd); if(what == DELETE_PORT) { driver_free(sd->bin); free(sd); } } } }
void MyFrame::OnWorkerEvent(wxThreadEvent& event) { int n = event.GetInt(); if ( n == -1 ) { m_dlgProgress->Destroy(); m_dlgProgress = (wxProgressDialog *)NULL; // the dialog is aborted because the event came from another thread, so // we may need to wake up the main event loop for the dialog to be // really closed wxWakeUpIdle(); } else { if ( !m_dlgProgress->Update(n) ) { wxCriticalSectionLocker lock(m_csCancelled); m_cancelled = true; } } }
void InstConsoleWindow::OnProcessTimer(wxTimerEvent& WXUNUSED(event)) { wxWakeUpIdle(); }
void Window::InvalidateAll() { GETWIN(id)->Refresh(false); wxWakeUpIdle(); }
void Notify() { wxWakeUpIdle(); /* send idle events */ }
void Window::InvalidateRectangle(PRectangle rc) { wxRect r = wxRectFromPRectangle(rc); GETWIN(id)->Refresh(false, &r); wxWakeUpIdle(); }
void wxGISMapView::OnTimer( wxTimerEvent& event ) { //event.Skip(); //wxSafeYield(this, true); #ifdef __WXGTK__ wxWakeUpIdle(); #endif switch(m_nDrawingState) { case enumGISMapZooming: { //stop zooming action if(m_pGISDisplay && !wxGetMouseState().LeftIsDown()) //user release mouse button, so draw contents { wxRect rc = GetClientRect(); m_pGISDisplay->SetDeviceFrame(rc); m_pGISDisplay->SetDerty(true); m_nDrawingState = enumGISMapDrawing; CreateAndRunDrawThread(); //wxCommandEvent evt(wxEVT_COMMAND_STARTDRAWING);wxEVT_COMMAND_DATA_SENT //GetEventHandler()->ProcessEvent( evt ); // if(!m_pMapDrawingThread)//m_nDrawingState = enumGISMapDrawing // { // StartDraingThread(); // } m_timer.Stop(); //Thaw(); } } break; case enumGISMapWheeling: m_nDrawingState = enumGISMapWheelingStop; return; case enumGISMapWheelingStop: //stop wheeling action if(m_pGISDisplay) { double dZoom = 1; if(m_nFactor < 0) dZoom = fabs(1.0 / (m_nFactor - 1)); else if(m_nFactor > 0) dZoom = 1 + m_nFactor; OGREnvelope Env = CreateEnvelopeFromZoomFactor(dZoom); if(Env.IsInit())//set new bounds Do(Env); m_nDrawingState = enumGISMapDrawing; } m_nFactor = 0; m_timer.Stop(); return; break; case enumGISMapFlashing: if(m_staFlashGeoms.empty()) { m_nDrawingState = enumGISMapDrawing; m_pGISDisplay->SetDrawCache(m_pGISDisplay->GetLastCacheID(), true); m_timer.Stop(); } else { Flash(m_eFlashStyle); } break; case enumGISMapDrawing: break;//not stop timer case enumGISMapNone: default: m_timer.Stop(); break; }; Refresh(); }
void OpenOCDDriver::OnTimer(wxTimerEvent& event) { wxWakeUpIdle(); }
void PipedProcess::OnTimer(wxTimerEvent& event) { wxWakeUpIdle(); }
void MyProcessOutput::OnTimer(wxTimerEvent& WXUNUSED(event)) { wxWakeUpIdle(); }