void MainFrame::OnThumbnailLoadDone(wxThreadEvent &event) { if (event.GetExtraLong() != threadId) return; GetStatusBar()->SetStatusText("Idle"); loadThread = nullptr; }
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); } } }
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 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(); }