void CDStarRepeaterApp::OnRemoteCmd(wxThreadEvent& event) { wxLogMessage("Request to execute command %s (%d)", m_commandLine[event.GetInt()], event.GetInt()); // XXX sanity check the command line here. wxShell(m_commandLine[event.GetInt()]); }
void CMainApp::OnResolverResponse(wxThreadEvent& event) { unsigned key = event.GetInt(); unsigned data = event.GetExtraLong(); CContact c = event.GetPayload<CContact>(); CJournalEntry *pE = findActiveEntry(key); if (pE != NULL) { if (data == RESOLVE_CALLER) { pE->setCallerName(c.getSN()); if (pE->getType() == CJournalEntry::J_INCOMING) { pE->setImage(c.getImage()); } } else if (data == RESOLVE_CALLED) { pE->setCalledName(c.getSN()); if (pE->getType() == CJournalEntry::J_OUTGOING) { pE->setImage(c.getImage()); } } m_pJournalModel->insertUpdateEntry(*pE); } else { CJournalEntry e; if (findJournalEntry(key, e)) { if (data == RESOLVE_CALLER) e.setCallerName(c.getSN()); if (data == RESOLVE_CALLED) e.setCalledName(c.getSN()); m_pJournalModel->insertUpdateEntry(e); } } }
/* TextEditor::onJumpToCalculateComplete * Called when the 'Jump To' calculation thread completes *******************************************************************/ void TextEditor::onJumpToCalculateComplete(wxThreadEvent& e) { if (!choice_jump_to) { jump_to_calculator = nullptr; return; } choice_jump_to->Clear(); jump_to_lines.clear(); string jump_points = e.GetString(); wxArrayString split = wxSplit(jump_points, ','); wxArrayString items; for (unsigned a = 0; a < split.size(); a += 2) { if (a == split.size() - 1) break; long line; if (!split[a].ToLong(&line)) line = 0; string name = split[a + 1]; items.push_back(name); jump_to_lines.push_back(line); } choice_jump_to->Append(items); choice_jump_to->Enable(true); jump_to_calculator = nullptr; }
void MyFrame::OnMoveComplete(wxThreadEvent& event) { try { Mount *pThisMount = event.GetPayload<Mount *>(); assert(pThisMount->IsBusy()); pThisMount->DecrementRequestCount(); Mount::MOVE_RESULT moveResult = static_cast<Mount::MOVE_RESULT>(event.GetInt()); pMount->LogGuideStepInfo(); if (moveResult != Mount::MOVE_OK) { if (moveResult == Mount::MOVE_STOP_GUIDING) { Debug.Write("mount move error indicates guiding should stop\n"); pGuider->StopGuiding(); } throw ERROR_INFO("Error reported moving"); } } catch (wxString Msg) { POSSIBLY_UNUSED(Msg); } }
void MainFrame::OnThumbnailLoadDone(wxThreadEvent &event) { if (event.GetExtraLong() != threadId) return; GetStatusBar()->SetStatusText("Idle"); loadThread = nullptr; }
void MainFrame::OnRBFComplete(wxThreadEvent& evt) { //stopTimer("RBF Stop"); m_RBF = NULL; m_bRBFrunning = false; showMessage(evt.GetString()); }
void CMainApp::OnNewCall(wxThreadEvent& event) { unsigned pid = event.GetInt(); TEventInfoNewCall info = event.GetPayload<TEventInfoNewCall>(); CJournalEntry *pCall = new CJournalEntry(pid, info.cid, CallType2JournalType(info.type)); pCall->setState(CallState2JournalState(info.status)); m_pJournalModel->insertUpdateEntry(*pCall); m_ActiveCalls.insert(std::make_pair(TJournalKey(pid, info.cid), pCall)); displayNotification(*pCall); }
void PMBUSQUERYProgressDialog::OnQUERYSequenceEnd(wxThreadEvent& event){ PSU_DEBUG_PRINT(MSG_DEBUG, "OnQUERYSequenceEnd"); int HasError = event.GetInt(); if (HasError == 1){ PSU_DEBUG_PRINT(MSG_ERROR, "Query Commands Failed ! Please Check PSU Device Status !"); } // Close Dialog this->EndModal(wxID_OK); }
void MainFrame::OnRBFUpdatePg(wxThreadEvent& evt) { int iteration = evt.GetInt() + 1 ; int total = m_RBF->m_nTotalIteration; m_gaugePg->SetValue(100*iteration/total); m_staticTextPg->SetLabel(wxString::Format("%d/%d", iteration, total)); m_staticTextTimer->SetLabel(getTimer()); }
void IndiGui::OnNewMessageFromThread(wxThreadEvent& event) { char *message = (char *) event.GetExtraLong(); if (message && strlen(message) > 0) { textbuffer->SetInsertionPoint(0); textbuffer->WriteText(wxString::FromAscii(message)); textbuffer->WriteText(_T("\n")); } #ifdef INDI_PRE_1_0_0 delete message; //http://sourceforge.net/p/indi/code/1803/ #endif }
void CMainApp::OnCallStateUpdate(wxThreadEvent& event) { unsigned pid = event.GetInt(); TEventInfoCallStatus info = event.GetPayload<TEventInfoCallStatus>(); TJournalMap::iterator it = m_ActiveCalls.find(TJournalKey(pid, info.cid)); if (it != m_ActiveCalls.end()) { if (info.status == TCALL_IDLE) { delete (it->second); m_ActiveCalls.erase(it); } else { it->second->setState(CallState2JournalState(info.status)); m_pJournalModel->insertUpdateEntry(*(it->second)); } } }
void IndiGui::OnNewTextFromThread(wxThreadEvent& event) { void *st; int i; ITextVectorProperty *tvp = (ITextVectorProperty *) event.GetExtraLong(); //printf("newtext from thread %s \n",tvp->name); wxString devname = wxString::FromAscii(tvp->device); wxString propname = wxString::FromAscii(tvp->name); IndiDev *indiDev = (IndiDev *) devlist[devname]; IndiProp *indiProp = (IndiProp *) indiDev->properties[propname]; for (i = 0; i < tvp->ntp; i++) { st = indiProp->ctrl[wxString::FromAscii(tvp->tp[i].name)]; wxStaticText *ctrl = (wxStaticText *)st; ctrl->SetLabel(wxString::Format(wxT("%s"), tvp->tp[i].text)); } indiProp->state->SetState(tvp->s); }
void IndiGui::OnNewNumberFromThread(wxThreadEvent& event) { void *st; int i; INumberVectorProperty *nvp = (INumberVectorProperty *) event.GetExtraLong(); //printf("newnumber from thread %s \n",nvp->name); wxString devname = wxString::FromAscii(nvp->device); wxString propname = wxString::FromAscii(nvp->name); IndiDev *indiDev = (IndiDev *) devlist[devname]; IndiProp *indiProp = (IndiProp *) indiDev->properties[propname]; for (i = 0; i < nvp->nnp; i++) { st = indiProp->ctrl[wxString::FromAscii(nvp->np[i].name)]; wxStaticText *ctrl = (wxStaticText *)st; ctrl->SetLabel(wxString::Format(wxT("%f"), nvp->np[i].value)); } indiProp->state->SetState(nvp->s); }
void IndiGui::OnNewDeviceFromThread(wxThreadEvent& event) { INDI::BaseDevice *dp = (INDI::BaseDevice *) event.GetExtraLong(); //printf("newdevice from thread %s \n",dp->getDeviceName()); wxString devname = wxString::FromAscii(dp->getDeviceName()); IndiDev *indiDev = new IndiDev(); wxPanel *panel = new wxPanel(parent_notebook); indiDev->page = new wxNotebook(panel, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxNB_TOP); wxBoxSizer *nb_sizer = new wxBoxSizer(wxVERTICAL); panel->SetSizer(nb_sizer); nb_sizer->Add(indiDev->page, 1, wxEXPAND | wxALL); parent_notebook->AddPage(panel, devname); indiDev->dp = dp; devlist[devname] = indiDev; panel->Fit(); sizer->Layout(); Fit(); }
void IndiGui::OnNewPropertyFromThread(wxThreadEvent& event) { INDI::Property *property = (INDI::Property *) event.GetExtraLong(); //printf("newproperty from thread %s %s %s\n",property->getDeviceName(),property->getGroupName(),property->getName()); wxString devname = wxString::FromAscii(property->getDeviceName()); wxString groupname = wxString::FromAscii(property->getGroupName()); wxString propname = wxString::FromAscii(property->getName()); IndiProp *indiProp = new IndiProp(); wxPanel *page; wxGridBagSizer *gbs; int next_free_row; IndiDev *indiDev = (IndiDev *)devlist[devname]; if (! indiDev) return; indiProp->idev = indiDev; page = (wxPanel *)indiDev->groups[groupname]; if (! page) { page = new wxPanel(indiDev->page); indiDev->page->AddPage(page, groupname); page->SetSizer(new wxGridBagSizer(0, 20)); indiDev->groups[groupname] = page; } gbs = (wxGridBagSizer *)page->GetSizer(); gbs->Layout(); next_free_row = gbs->GetRows(); BuildPropWidget(property, page, indiProp); gbs->Add(indiProp->state, POS(next_free_row, 0), SPAN(1, 1), wxALIGN_LEFT | wxALL); gbs->Add(indiProp->name, POS(next_free_row, 1), SPAN(1, 1), wxALIGN_LEFT | wxALL); gbs->Add(indiProp->panel,POS(next_free_row, 2), SPAN(1, 1), wxALIGN_LEFT | wxEXPAND | wxALL); gbs->Layout(); page->Fit(); panel->Fit(); page->Show(); indiDev->properties[propname] = indiProp; indiDev->page->Fit(); indiDev->page->Layout(); indiDev->page->Show(); sizer->Layout(); Fit(); }
void IndiGui::OnNewSwitchFromThread(wxThreadEvent& event) { void *st; int i,idx; ISwitchVectorProperty *svp = (ISwitchVectorProperty *) event.GetExtraLong(); //printf("newswitch from thread %s \n",svp->name); wxString devname = wxString::FromAscii(svp->device); wxString propname = wxString::FromAscii(svp->name); int swtype = GetSwitchType(svp); IndiDev *indiDev = (IndiDev *) devlist[devname]; IndiProp *indiProp = (IndiProp *) indiDev->properties[propname]; switch (swtype) { case SWITCH_COMBOBOX: { idx=0; for (i = 0; i < svp->nsp; i++){ if(svp->sp[i].s == ISS_ON) idx = i; } st = indiProp->ctrl[wxString::FromAscii(svp->name)]; wxChoice *combo = (wxChoice *)st; combo->SetSelection(idx); break; } case SWITCH_CHECKBOX:{ for (i = 0; i < svp->nsp; i++){ st = indiProp->ctrl[wxString::FromAscii(svp->sp[i].name)]; wxCheckBox *button = (wxCheckBox *) st; button->SetValue(svp->sp[i].s ? true : false); } break; } case SWITCH_BUTTON:{ for (i = 0; i < svp->nsp; i++){ st = indiProp->ctrl[wxString::FromAscii(svp->sp[i].name)]; wxToggleButton *button = (wxToggleButton *) st; button->SetValue(svp->sp[i].s ? true : false); } break; } } }
void IndiGui::OnRemovePropertyFromThread(wxThreadEvent& event) { IndiProp *indiProp = (IndiProp *)event.GetExtraLong(); if (! indiProp) return; IndiDev *indiDev = (IndiDev *) indiProp->idev; if (! indiDev) return; wxString propname = indiProp->PropName; for (int y = 0; y < indiProp->gbs->GetRows(); y++) { for (int x = 0; x < indiProp->gbs->GetCols(); x++) { wxGBSizerItem *item = indiProp->gbs->FindItemAtPosition(POS(y, x)); if (item){ indiProp->gbs->Remove(item->GetId()); item->GetWindow()->Destroy(); } } } indiProp->gbs->Layout(); if (indiProp->name) indiProp->name->Destroy(); if (indiProp->state) indiProp->state->Destroy(); if (indiProp->panel) indiProp->panel->Destroy(); if (indiProp->page->GetChildren().GetCount() == 0) { for (unsigned int i = 0; i < indiDev->page->GetPageCount(); i++) { if (indiProp->page == indiDev->page->GetPage(i)) { indiDev->groups.erase(indiDev->page->GetPageText(i)); indiDev->page->DeletePage(i); break; } } } delete indiProp; indiDev->properties.erase(propname); indiDev->page->Layout(); indiDev->page->Fit(); sizer->Layout(); Fit(); }
void MyFrame::OnMoveComplete(wxThreadEvent& event) { try { Mount *mount = event.GetPayload<Mount *>(); assert(mount->IsBusy()); mount->DecrementRequestCount(); Mount::MOVE_RESULT moveResult = static_cast<Mount::MOVE_RESULT>(event.GetInt()); mount->LogGuideStepInfo(); // deliver the outstanding GuidingStopped notification if this is a late-arriving // move completion event if (!pGuider->IsCalibratingOrGuiding() && (!pMount || !pMount->IsBusy()) && (!pSecondaryMount || !pSecondaryMount->IsBusy())) { pFrame->NotifyGuidingStopped(); } if (moveResult != Mount::MOVE_OK) { mount->IncrementErrorCount(); if (moveResult == Mount::MOVE_STOP_GUIDING) { Debug.Write("mount move error indicates guiding should stop\n"); pGuider->StopGuiding(); } throw ERROR_INFO("Error reported moving"); } } catch (const wxString& Msg) { POSSIBLY_UNUSED(Msg); } }
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 CMainApp::OnCallInfoUpdate(wxThreadEvent& event) { unsigned pid = event.GetInt(); TEventInfoCallInfo info = event.GetPayload<TEventInfoCallInfo>(); TJournalMap::iterator it = m_ActiveCalls.find(TJournalKey(pid, info.cid)); if (it != m_ActiveCalls.end()) { CJournalEntry *pJ = it->second; if (pJ->getCalledName().IsEmpty()) { pJ->setCalledName(info.info.m_strCalledName); } if (pJ->getCallerName().IsEmpty()) { pJ->setCallerName(info.info.m_strCallerName); } if (pJ->getCalledAddress().IsEmpty() && !info.info.m_strCalledAddress.empty()) { ResolveCalled(info.info.m_strCalledAddress, pJ); } if (pJ->getCallerAddress().IsEmpty() && !info.info.m_strCallerAddress.empty()) { ResolveCaller(info.info.m_strCallerAddress, pJ); } m_pJournalModel->insertUpdateEntry(*pJ); } }
// update gui void NetPlayDialog::OnThread(wxThreadEvent& event) { if (m_is_hosting && m_host_label && g_TraversalClient) { UpdateHostLabel(); } // player list m_playerids.clear(); std::string tmps; netplay_client->GetPlayerList(tmps, m_playerids); wxString selection; if (m_player_lbox->GetSelection() != wxNOT_FOUND) selection = m_player_lbox->GetString(m_player_lbox->GetSelection()); m_player_lbox->Clear(); std::istringstream ss(tmps); while (std::getline(ss, tmps)) m_player_lbox->Append(StrToWxStr(tmps)); // remove ping from selection string, in case it has changed selection.erase(selection.rfind('|') + 1); if (!selection.empty()) { for (unsigned int i = 0; i < m_player_lbox->GetCount(); ++i) { if (selection == m_player_lbox->GetString(i).substr(0, selection.length())) { m_player_lbox->SetSelection(i); break; } } } // flash window in taskbar when someone joins if window isn't active static u8 numPlayers = 1; if (netplay_server != nullptr && numPlayers < m_playerids.size() && !HasFocus()) { RequestUserAttention(); } numPlayers = m_playerids.size(); switch (event.GetId()) { case NP_GUI_EVT_CHANGE_GAME: // update selected game :/ { m_selected_game = WxStrToStr(event.GetString()); wxString button_label = event.GetString(); m_game_btn->SetLabel(button_label.Prepend(_(" Game : "))); } break; case NP_GUI_EVT_START_GAME: // client start game :/ { netplay_client->StartGame(FindCurrentGame()); std::string msg = "Starting game"; AddChatMessage(ChatMessageType::Info, msg); } break; case NP_GUI_EVT_STOP_GAME: // client stop game { std::string msg = "Stopping game"; AddChatMessage(ChatMessageType::Info, msg); } break; case NP_GUI_EVT_DISPLAY_MD5_DIALOG: { m_MD5_dialog = new MD5Dialog(this, netplay_server, netplay_client->GetPlayers(), event.GetString().ToStdString()); m_MD5_dialog->Show(); } break; case NP_GUI_EVT_MD5_PROGRESS: { if (m_MD5_dialog == nullptr || m_MD5_dialog->IsBeingDeleted()) break; std::pair<int, int> payload = event.GetPayload<std::pair<int, int>>(); m_MD5_dialog->SetProgress(payload.first, payload.second); } break; case NP_GUI_EVT_MD5_RESULT: { if (m_MD5_dialog == nullptr || m_MD5_dialog->IsBeingDeleted()) break; std::pair<int, std::string> payload = event.GetPayload<std::pair<int, std::string>>(); m_MD5_dialog->SetResult(payload.first, payload.second); } break; case NP_GUI_EVT_PAD_BUFFER_CHANGE: { std::string msg = StringFromFormat("Buffer size: %d", m_pad_buffer); if (g_ActiveConfig.bShowNetPlayMessages) { OSD::AddTypedMessage(OSD::MessageType::NetPlayBuffer, msg, OSD::Duration::NORMAL); } AddChatMessage(ChatMessageType::Info, msg); } break; case NP_GUI_EVT_DESYNC: { std::string msg = "Possible desync detected from player " + m_desync_player + " on frame " + std::to_string(m_desync_frame); AddChatMessage(ChatMessageType::Error, msg); if (g_ActiveConfig.bShowNetPlayMessages) { OSD::AddMessage(msg, OSD::Duration::VERY_LONG, OSD::Color::RED); } } break; case NP_GUI_EVT_CONNECTION_LOST: { std::string msg = "Lost connection to server"; AddChatMessage(ChatMessageType::Error, msg); } break; case NP_GUI_EVT_TRAVERSAL_CONNECTION_ERROR: { std::string msg = "Traversal server connection error"; AddChatMessage(ChatMessageType::Error, msg); } } // chat messages while (m_chat_msgs.Size()) { std::string s; m_chat_msgs.Pop(s); AddChatMessage(ChatMessageType::UserIn, s); if (g_ActiveConfig.bShowNetPlayMessages) { OSD::AddMessage(s, OSD::Duration::NORMAL, OSD::Color::GREEN); } } }
void MyFrame::OnExposeComplete(wxThreadEvent& event) { usImage *image = event.GetPayload<usImage *>(); bool err = event.GetInt() != 0; OnExposeComplete(image, err); }
void MyImageDialog::OnGUIThreadEvent(wxThreadEvent& event) { m_nCurrentProgress = int(((float)event.GetInt()*100)/GUITHREAD_NUM_UPDATES); Refresh(); }
void MyDllApp::OnShowWindow(wxThreadEvent& event) { wxFrame *f = new MyDllFrame(NULL, event.GetString()); f->Show(true); }
void PMBUSQUERYProgressDialog::OnQUERYSequenceUpdate(wxThreadEvent& event){ PSU_DEBUG_PRINT(MSG_DEBUG, "OnQUERYSequenceUpdate : %d", event.GetInt()); this->m_infoST->SetLabel(wxString::Format("%3d/%3d", event.GetInt()+1, PMBUSHelper::GetCurrentCMDTableSize())); }
/* MainApp::onVersionCheckCompleted * Called when the VersionCheck thread completes *******************************************************************/ void MainApp::onVersionCheckCompleted(wxThreadEvent& e) { // Check failed if (e.GetString() == "connect_failed") { LOG_MESSAGE(1, "Version check failed, unable to connect"); if (update_check_message_box) wxMessageBox("Update check failed: unable to connect to internet. Check your connection and try again.", "Check for Updates"); return; } wxArrayString info = wxSplit(e.GetString(), '\n'); // Check for correct info if (info.size() != 5) { LOG_MESSAGE(1, "Version check failed, received invalid version info"); if (update_check_message_box) wxMessageBox("Update check failed: received invalid version info.", "Check for Updates"); return; } // Get version numbers long version_stable, version_beta, beta_num; info[0].ToLong(&version_stable); info[2].ToLong(&version_beta); info[3].ToLong(&beta_num); LOG_MESSAGE(1, "Latest stable release: v%ld \"%s\"", version_stable, info[1].Trim()); LOG_MESSAGE(1, "Latest beta release: v%ld_b%ld \"%s\"", version_beta, beta_num, info[4].Trim()); // Check if new stable version bool new_stable = false; if (Global::version_num < version_stable || // New stable version (Global::version_num == version_stable && Global::beta_num > 0)) // Stable version of current beta new_stable = true; // Check if new beta version bool new_beta = false; if (version_stable < version_beta) { // Stable -> Beta if (Global::version_num < version_beta && Global::beta_num == 0) new_beta = true; // Beta -> Beta else if (Global::version_num < version_beta || // New version beta (Global::beta_num < beta_num && Global::version_num == version_beta && Global::beta_num > 0)) // Same version, newer beta new_beta = true; } // Ask for new beta if (update_check_beta && new_beta) { if (wxMessageBox(S_FMT("A new beta version of SLADE is available (%s), click OK to visit the SLADE homepage and download the update.", info[4].Trim()), "New Beta Version Available", wxOK|wxCANCEL) == wxOK) wxLaunchDefaultBrowser("http://slade.mancubus.net/index.php?page=downloads"); return; } // Ask for new stable if (new_stable) { if (wxMessageBox(S_FMT("A new version of SLADE is available (%s), click OK to visit the SLADE homepage and download the update.", info[1].Trim()), "New Version Available", wxOK|wxCANCEL) == wxOK) wxLaunchDefaultBrowser("http://slade.mancubus.net/index.php?page=downloads"); return; } LOG_MESSAGE(1, "Already up-to-date"); if (update_check_message_box) wxMessageBox("SLADE is already up to date", "Check for Updates"); }
void MainFrame::OnRBFUpdate(wxThreadEvent& evt) { showMessage(evt.GetString()); }
// update gui void NetPlayDialog::OnThread(wxThreadEvent& event) { if (m_is_hosting && m_host_label && g_TraversalClient) { UpdateHostLabel(); } // player list m_playerids.clear(); std::string tmps; netplay_client->GetPlayerList(tmps, m_playerids); wxString selection; if (m_player_lbox->GetSelection() != wxNOT_FOUND) selection = m_player_lbox->GetString(m_player_lbox->GetSelection()); m_player_lbox->Clear(); std::istringstream ss(tmps); while (std::getline(ss, tmps)) m_player_lbox->Append(StrToWxStr(tmps)); // remove ping from selection string, in case it has changed selection.erase(selection.rfind('|') + 1); if (!selection.empty()) { for (unsigned int i = 0; i < m_player_lbox->GetCount(); ++i) { if (selection == m_player_lbox->GetString(i).substr(0, selection.length())) { m_player_lbox->SetSelection(i); break; } } } // flash window in taskbar when someone joins if window isn't active static u8 numPlayers = 1; if (netplay_server != nullptr && numPlayers < m_playerids.size() && !HasFocus()) { RequestUserAttention(); } numPlayers = m_playerids.size(); switch (event.GetId()) { case NP_GUI_EVT_CHANGE_GAME: // update selected game :/ { m_selected_game = WxStrToStr(event.GetString()); wxString button_label = event.GetString(); m_game_btn->SetLabel(button_label.Prepend(_(" Game : "))); } break; case NP_GUI_EVT_START_GAME: // client start game :/ { netplay_client->StartGame(FindGame()); } break; case NP_GUI_EVT_STOP_GAME: // client stop game { netplay_client->StopGame(); } break; } // chat messages while (chat_msgs.Size()) { std::string s; chat_msgs.Pop(s); // PanicAlert("message: %s", s.c_str()); m_chat_text->AppendText(StrToWxStr(s).Append('\n')); } }
void CMakeHelpTab::OnThreadUpdate(wxThreadEvent& event) { // Notify about update m_gaugeLoad->SetValue(event.GetInt()); m_gaugeLoad->Update(); }
void VCameraControl::OnCompleteCaptureThread(wxThreadEvent & event) { capture = 0; event.Skip(); }