void ribi::gtst::ParticipantDialogStateFinished::ShowPage(ParticipantDialog * const dialog) { assert(dialog); assert(GetDialog()); assert(GetDialog()->GetParticipant()); assert(m_server->GetParameters()); assert(m_server->GetParameters()->GetFinished()); const double total_payoff = dialog->GetParticipant()->GetPayoffs()->GetTotal(); const double earnings = m_server->GetParameters()->GetFinished()->CalculateEarnings(total_payoff); dialog->addWidget(new Wt::WBreak); //Display the status message dialog->addWidget( new Wt::WLabel( m_server->GetParameters()->GetFinished()->GetMessage().c_str())); dialog->addWidget(new Wt::WBreak); dialog->addWidget(new Wt::WBreak); dialog->addWidget( new Wt::WLabel( std::string("You have obtained a total payoff of ") + CurrencyToStr(total_payoff))); dialog->addWidget(new Wt::WBreak); dialog->addWidget(new Wt::WBreak); dialog->addWidget( new Wt::WLabel( std::string("You have earned ") + CurrencyToStr( earnings) + " euros")); }
void SGOglMaterialNBPage::OnButton(wxCommandEvent& event) { SGFixedGLState* glState = this->m_parent->GetGLState(); Material* mat = glState->GetMaterial(); glState->SetMaterialChanged(true); switch(event.GetId()) { case Id::AmbientMaterialVal : mat->materialAmbientColorVector = GetDialog(mat, 1); ambientMaterial->SetBackgroundColour(ToWxIntColor(mat->materialAmbientColorVector)); break; case Id::DiffuseMaterialVal : mat->materialDiffuseColorVector = GetDialog(mat, 2); diffuseMaterial->SetBackgroundColour(ToWxIntColor(mat->materialDiffuseColorVector)); break; case Id::SpecularMaterialVal : mat->materialSpecularColorVector = GetDialog(mat, 3); specularMaterial->SetBackgroundColour(ToWxIntColor(mat->materialSpecularColorVector)); break; case Id::EmissionMaterialVal : mat->materialEmissionColorVector = GetDialog(mat, 4); emissionMaterial->SetBackgroundColour(ToWxIntColor(mat->materialEmissionColorVector)); break; default : break; } wxGetApp().GetFrame()->SetCanvasMode(0); wxGetApp().GetFrame()->GetCanvas()->Update(); event.Skip(); }
//--------------------------------------------------------------------------- void ribi::gtst::ParticipantDialogStateLoggedIn::ShowPage(ParticipantDialog * const dialog) { assert(dialog); assert(GetDialog()->GetParticipant()); assert(GetDialog()->GetParticipant()->CanGetId() && "A Participant must have became an ID before being logged in"); assert(GetDialog()->GetParticipant()->CanGetIpAddress() && "A Participant must have became an IP address before being logged in"); //Create the GUI widgets ui.m_label_status = new Wt::WLabel; new Wt::WBreak(dialog); new Wt::WLabel("Welcome",dialog); new Wt::WBreak(dialog); new Wt::WBreak(dialog); new Wt::WLabel("Please wait for the experiment to begin",dialog); //new Wt::WLabel( // (std::string("You have been assigned an ID of ") // + std::to_string(GetDialog()->GetParticipant()->GetId())).c_str() // ,dialog); new Wt::WBreak(dialog); new Wt::WBreak(dialog); dialog->addWidget(ui.m_label_status); }
/** * Function name CInsertGlobVarFile::FillDialog * Description * @return void * @exception * @see */ void CInsertGlobVarFile::FillDialog() { //Standart name CString sName = GetNameProposal(m_sName); GetDialog()->SetCreateUser(m_sCreateUser); GetDialog()->SetCreateDate(m_sCreateDate); GetDialog()->SetLastModUser(m_sLastModUser); GetDialog()->SetLastModDate(m_sLastModDate); GetDialog()->SetName(sName); }
/** * Function name CInsertFunction::FillDialog * Description * @return void * @exception * @see */ void CInsertFunction::FillDialog() { //Standart name CString sName = GetNameProposal(m_sName); GetDialog()->SetCreateUser(m_sCreateUser); GetDialog()->SetCreateDate(m_sCreateDate); GetDialog()->SetLastModUser(m_sLastModUser); GetDialog()->SetLastModDate(m_sLastModDate); GetDialog()->SetName(sName);//Set the standart name }
static void __fastcall TestAcadWindow(void) { //------------------------------------------------------------------------------- // Проверяет наличие несанкционированного окна автокада | // Если обнаруживает - убивает его нАфих! | //------------------------------------------------------------------------------- if (!NeedTestAcadWindow) return; if (ss0 == NULL) { ss0 = new TSnapShot(); ss0->Scan(); ss1 = new TSnapShot(); return; } if (!NeedTestAcadWindow) return; ss1->Scan(); if (!NeedTestAcadWindow) return; if (ss0->Compare(ss1, 0) != -1) { ss0->Accept(ss1); SameSnapshotCount = 0; return; } if (++SameSnapshotCount < 5) return; // if (++SameSnapshotCount < 15) return; // if (++SameSnapshotCount < 3) return; // -------------------- Что-то долго застряли на одном и том же автокадовском окне HWND dialog; int i, j; bool processed; for (i = 0; i < ss0->Count; i++) { if (!NeedTestAcadWindow) break; if (ss0->handles[i] == NULL) continue; dialog = GetDialog((HWND)ss0->handles[i]); if (dialog == NULL) continue; GetDialog((HWND)ss0->handles[i]); for (j = 0, processed = false; j < i; j++) { // if (ss0->handles[j] == ss0->handles[i]) { if (ss0->handles[j] == dialog) { processed = true; break; } } ss0->handles[i] = dialog; if (processed) continue; KillDialog(dialog); } SameSnapshotCount = 0; }
void CBMacroTable::SaveMacros() const { JString origName; if ((GetDialog())->ContentsValid() && (GetDialog())->GetCurrentMacroSetName(&origName)) { JString newName; if (itsCSF->SaveFile(JGetString(kSavePromptID), NULL, origName, &newName)) { WriteData(newName); } } }
/** * Function name CInsertFunction::Init * Description * @return void * @exception * @see */ void CInsertFunction::Init() { m_sAlias = GetDialog()->GetAlias(); m_sName = GetDialog()->GetName(); m_sUsrText[0] = GetDialog()->GetText1(); m_sUsrText[1] = GetDialog()->GetText2(); m_sUsrText[2] = GetDialog()->GetText3(); m_sHelpUrl = GetDialog()->GetHelpUrl(); m_sUrl = GetDialog()->GetUrl(); m_sFunctionType = GetDialog()->GetReturnType(); m_pMembers = GetDialog()->GetMembers(); m_sHelpTemplate = GetDialog()->GetPathOfSelectedTemplate(); COperation::Init(); SetPouDT(TRUE); //TRUE for Insert (FALSE for Prop) }
void CDocumentPreview::SizePreviewWindow(int nWidth, int nHeight) { m_crPreview.left = (m_crFullPreview.left+m_crFullPreview.right-nWidth)/2; m_crPreview.top = (m_crFullPreview.top+m_crFullPreview.bottom-nHeight)/2; m_crPreview.right = m_crPreview.left + nWidth; m_crPreview.bottom = m_crPreview.top + nHeight; CRect r = m_crPreview; // We can't both set and show the window at the same time // with SetWindowPos. So, we call it twice as needed. CWnd* pPreviewWnd = GetPreviewWnd(); pPreviewWnd->SetWindowPos(NULL, r.left-1, r.top-1, nWidth+2, nHeight+2, SWP_NOZORDER | SWP_NOREDRAW); pPreviewWnd->SetWindowPos(NULL, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOREDRAW | SWP_SHOWWINDOW); // Invalidate ourselves to avoid background draw. CWnd* pDialog = GetDialog(); pDialog->ClientToScreen(&m_crPreview); pPreviewWnd->ScreenToClient(&m_crPreview); r = m_crPreview; r.left--; r.top--; r.right++; r.bottom++; pPreviewWnd->InvalidateRect(&r, FALSE); }
void ribi::gtst::ParticipantDialogStateChooseAction::OnChooseActionClick() { const int action_index = ui.m_group->selectedButtonIndex(); ///Check if user did not click vote, without selecting a radiobutton if (action_index == -1) return; { assert(action_index < boost::numeric_cast<int>( m_server->GetParameters()->GetChooseAction()->GetOptions().size())); ServerStateChooseAction * const server_state = dynamic_cast<ServerStateChooseAction*>(m_server->GetStates()->GetCurrentState()); if (!server_state) { std::clog << __func__ << ": warning: no ServerStateChooseAction\n"; return; } server_state->NotifyChosenAction( GetDialog()->GetParticipant(), m_server->GetParameters()->GetChooseAction()->GetOptions()[action_index].get()); } ///Log the action ui.m_button_choose_action->setEnabled(false); assert(ui.m_group->selectedButtonIndex() != -1 && "m_button_choose_action should only disable when an action is selected"); const auto buttons = ui.m_group->buttons(); std::for_each(buttons.begin(),buttons.end(), [](Wt::WRadioButton * const r) { r->setEnabled(false); } ); }
ribi::QtOpenQuestionDialog::QtOpenQuestionDialog( const boost::shared_ptr<OpenQuestionDialog> dialog, QWidget *parent) : QtQuestionDialog(parent), ui(new Ui::QtOpenQuestionDialog), m_dialog(dialog) { assert(m_dialog); assert(GetDialog()); ui->setupUi(this); const boost::shared_ptr<const OpenQuestion> question { m_dialog->GetOpenQuestion() }; assert(question); if (fileio::IsRegularFile(question->GetFilename().c_str())) { ui->image->setPixmap(QPixmap(question->GetFilename().c_str())); } ui->stackedWidget->setCurrentWidget(ui->page_question); ui->label_question->setText(question->GetQuestion().c_str()); ui->label_question_again->setText(question->GetQuestion().c_str()); ui->label_answer->setText(question->GetCorrectAnswers()[0].c_str()); }
/** * Function name CInsertFunction::SetFileName * Description * @return void * @exception * @see */ void CInsertFunction::SetFileName() { m_sFileName = m_sName; CString sWizardLanguage = GetDialog()->GetLanguageOfSelectedWizard(); if(sWizardLanguage == _T("FBD")) { m_sFileName += _T(".4gr"); //Function Block Diagram m_FileType = FILETYPE_FBD; return; } if(sWizardLanguage == _T("LD")) { m_sFileName += _T(".4gr"); //Ladder Diagram m_FileType = FILETYPE_LD; return; } if(sWizardLanguage == _T("ST")) { m_sFileName += _T(".st"); //Structured Text m_FileType = FILETYPE_ST; return; } if(sWizardLanguage == _T("IL")) { m_sFileName += _T(".il"); //Instruction List m_FileType = FILETYPE_IL; return; } }
// Helper for pages to get the attributes to reset wxRichTextAttr* wxRichTextFormattingDialog::GetDialogResetAttributes(wxWindow* win) { wxRichTextFormattingDialog* dialog = GetDialog(win); if (dialog) return & dialog->GetResetAttributes(); else return NULL; }
// Helper for pages to get the style wxRichTextStyleDefinition* wxRichTextFormattingDialog::GetDialogStyleDefinition(wxWindow* win) { wxRichTextFormattingDialog* dialog = GetDialog(win); if (dialog) return dialog->GetStyleDefinition(); else return NULL; }
void OBJFormatDialog::Init(void) { PIItem item; PIDialogPtr dialog = GetDialog(); ostringstream stringStream; item = PIGetDialogItem(dialog, kDListBox); resourceList.SetItem(item); resourceList.Clear(); GetResourceNames(resourceInfos); size_t count = resourceInfos.size(); size_t nItem; size_t index; for (index = 0; index < count; index++) { stringStream.str(""); stringStream << resourceInfos.at(index)->id << " " << resourceInfos.at(index)->name.c_str(); nItem = resourceList.AppendItem(stringStream.str().c_str()); resourceList.SetUserData((int32)nItem, (int32)index); } resourceList.SetCurrentSelection(0); index = resourceList.GetUserData(0); item = PIGetDialogItem(dialog, kDType); resourceType.SetItem(item); stringStream.str(""); stringStream << resourceInfos.at(index)->type; resourceType.SetText(stringStream.str().c_str()); item = PIGetDialogItem(dialog, kDID); resourceID.SetItem(item); stringStream.str(""); stringStream << resourceInfos.at(index)->id; resourceID.SetText(stringStream.str().c_str()); item = PIGetDialogItem(dialog, kDName); resourceName.SetItem(item); stringStream.str(""); stringStream << resourceInfos.at(index)->name.c_str(); resourceName.SetText(stringStream.str().c_str()); item = PIGetDialogItem(dialog, kDSize); resourceSize.SetItem(item); stringStream.str(""); stringStream << resourceInfos.at(index)->size; resourceSize.SetText(stringStream.str().c_str()); item = PIGetDialogItem(dialog, kDKeep); resourceKeep.SetItem(item); resourceKeep.SetChecked(resourceInfos.at(index)->keep); }
void CDialogScrollView::OnInitialUpdate() { CScrollView::OnInitialUpdate(); SetScrollSizes(MM_TEXT, CSize(100,100)); CDialog* pDlg = GetDialog(); if (pDlg != NULL) { static_cast<CGenericDialog*>(pDlg)->InitData(false); } }
void UIFileNameEditor::OnBrowseClicked(UIButton* sender) { FString filename = ShowFileSelectionDialog(bIsSaveDialog, GetDialog(), *Path, InitialDirectory, Title, Filters); if (!filename.IsEmpty()) { *Path = filename; Editor->SetText(); } }
DlgEdit::DlgEdit(window_ptr Owner,size_t Index,DLGEDITTYPE Type): SimpleScreenObject(std::move(Owner)), LastPartLength(-1), m_Index(Index), Type(Type), iHistory(nullptr), #if defined(PROJECT_DI_MEMOEDIT) multiEdit(nullptr), #endif lineEdit(nullptr) { switch (Type) { case DLGEDIT_MULTILINE: #if defined(PROJECT_DI_MEMOEDIT) multiEdit=new Editor(pOwner,true); // ??? (pOwner) ? #endif break; case DLGEDIT_SINGLELINE: { EditControl::Callback callback={true,EditChange,this}; FarList* iList = nullptr; DWORD iFlags=0; auto& CurItem=GetDialog()->Items[Index]; if(Global->Opt->Dialogs.AutoComplete && CurItem.Flags&(DIF_HISTORY|DIF_EDITPATH|DIF_EDITPATHEXEC) && !(CurItem.Flags&DIF_DROPDOWNLIST) && !(CurItem.Flags&DIF_NOAUTOCOMPLETE)) { iFlags=EditControl::EC_ENABLEAUTOCOMPLETE; } if(CurItem.Flags&DIF_HISTORY && !CurItem.strHistory.empty()) { SetHistory(CurItem.strHistory); } if(CurItem.Type == DI_COMBOBOX) { iList=CurItem.ListItems; } if(CurItem.Flags&DIF_HISTORY) { iFlags|=EditControl::EC_COMPLETE_HISTORY; } if(CurItem.Flags&DIF_EDITPATH) { iFlags|=EditControl::EC_COMPLETE_FILESYSTEM; } if(CurItem.Flags&DIF_EDITPATHEXEC) { iFlags|=EditControl::EC_COMPLETE_PATH; } iFlags|=EditControl::EC_COMPLETE_ENVIRONMENT; lineEdit = std::make_unique<EditControl>(GetOwner(), GetOwner().get(), nullptr, &callback, iHistory.get(), iList, iFlags); } break; } }
void DlgEdit::DoEditChange() { auto dialog=GetDialog(); _DIALOG(CleverSysLog CL(L"DlgEdit::DoEditChange()")); _DIALOG(SysLog(L"m_Owner=%p, m_Owner->IsInited()=%d, m_Index=%d",dialog,dialog->IsInited(),m_Index)); if (dialog->IsInited()) { dialog->SendMessage(DN_EDITCHANGE,m_Index,0); } }
void CBMacroTable::LoadMacros() { JString fileName; if ((GetDialog())->ContentsValid() && itsCSF->ChooseFile("", NULL, &fileName)) { ReadData(fileName, itsCSF->ReplaceExisting()); } }
void ribi::gtst::ParticipantDialogStateAssignPayoff::RespondToTimedServerPush() { assert(GetDialog()->CanGetParticipant() && "Assume that only existing participants can have their payoffs assigned"); //Do nothing... //Display the Participant RespondToParticipant(); }
/** * Function name CInsertConstant::FillDialog * Description * @return void * @exception * @see */ void CInsertConstant::FillDialog() { SetFileName(); ParseConstFile(); if(!m_pConstList) { return; } InitFromFile(m_pConstList); //Standart name CString strName = _T("Const"); strName = GetNameProposal(strName); GetDialog()->SetCreateUser(m_sCreateUser); GetDialog()->SetCreateDate(m_sCreateDate); GetDialog()->SetLastModUser(m_sLastModUser); GetDialog()->SetLastModDate(m_sLastModDate); GetDialog()->SetName(strName); }
//--------------------------------------------------------------------------- void ribi::gtst::ParticipantDialogStateLoggedIn::RespondToTimedServerPush() { const auto participant = GetDialog()->GetParticipant(); if (dynamic_cast<const ParticipantStateLoggedIn*>(participant->GetState())) { const ParticipantStateLoggedIn* const state = dynamic_cast<const ParticipantStateLoggedIn*>(participant->GetState()); ui.m_label_status->setText(state->GetMessage().c_str()); } RespondToParticipant(); }
//--------------------------------------------------------------------------- void ParticipantDialogStateGroupAssign::ShowPage(ParticipantDialog * const dialog) { assert(dialog); assert(GetDialog()->CanGetParticipant() && "A Participant must be logged in in this state"); assert(GetDialog()->GetParticipant()->CanGetId() && "A Participant must be assigned an ID before entering this state"); const auto participant = dialog->GetParticipant(); //Create the widget(s) ui.m_label_group = new Wt::WLabel; ui.m_label_status = new Wt::WLabel; //Check the widget(s) assert(ui.m_label_status); assert(ui.m_label_group); //Add the widgets to the dialog->addWidget(new Wt::WBreak); dialog->addWidget(new Wt::WBreak); { const std::string id = "You have been assigned ID " + std::to_string(participant->GetId()); dialog->addWidget(new Wt::WLabel(id.c_str())); } dialog->addWidget(new Wt::WBreak); dialog->addWidget(new Wt::WBreak); dialog->addWidget(ui.m_label_group); const Group * const group = m_server->GetGroups()->FindMyGroup(participant); ui.m_label_group->setText( (dynamic_cast<const GroupParticipating*>(group) ? m_server->GetParameters()->GetGroupAssign()->GetMessageAssigned() + std::to_string(dynamic_cast<const GroupParticipating*>(group)->GetId()) : m_server->GetParameters()->GetGroupAssign()->GetMessageUnassigned() ).c_str() ); }
/** * Function name CInsertConstant::Init * Description * @return void * @exception * @see */ void CInsertConstant::Init() { //Init Constant from Dialog CString Dummy; Dummy = GetDialog()->GetName(); m_Const.SetObjName(Dummy); Dummy = GetDialog()->GetAlias(); m_Const.SetObjAlias(Dummy); Dummy = GetDialog()->GetVarComment(); m_Const.SetObjVarComment(Dummy); Dummy = GetDialog()->GetType(); m_Const.SetVarType(Dummy); Dummy.LoadString(IDS_KEY_CONST); m_Const.SetVarStorageClass(Dummy); int iClass = VarStorageClassByString(Dummy); ASSERT(iClass != -1); m_Const.SetVarAttr(iClass); Dummy = GetDialog()->GetValue(); m_Const.SetVarInitVal(Dummy); COperation::Init(); SetPouDT(TRUE); //TRUE for Insert (FALSE for Prop) }
void CDocumentPreview::ErasePreview(void) { CRect r = m_crPreview; r.InflateRect(1, 1); CWnd* pPreviewWnd = GetPreviewWnd(); CWnd* pDialog = GetDialog(); if (pPreviewWnd != NULL && pDialog != NULL) { pPreviewWnd->ClientToScreen(&r); pDialog->ScreenToClient(&r); pDialog->InvalidateRect(&r); } }
/** * Function name CInsertGlobVarFile::Init * Description * @return void * @exception * @see */ void CInsertGlobVarFile::Init() { m_sAlias = GetDialog()->GetAlias(); m_sName = GetDialog()->GetName(); m_sUsrText[0] = GetDialog()->GetText1(); m_sUsrText[1] = GetDialog()->GetText2(); m_sUsrText[2] = GetDialog()->GetText3(); m_sHelpUrl = GetDialog()->GetHelpUrl(); m_sUrl = GetDialog()->GetUrl(); COperation::Init(); SetPouDT(TRUE); //TRUE for Insert (FALSE for Prop) }
void CPropFunction::Init() { m_sAlias = GetDialog()->GetAlias(); m_sName = GetDialog()->GetName(); m_sUsrText[0] = GetDialog()->GetText1(); m_sUsrText[1] = GetDialog()->GetText2(); m_sUsrText[2] = GetDialog()->GetText3(); m_sHelpUrl = GetDialog()->GetHelpUrl(); m_sUrl = GetDialog()->GetUrl(); m_sFunctionType = GetDialog()->GetReturnType(); m_sHelpTemplate = GetDialog()->GetPathOfSelectedTemplate(); if(m_pMembers) { ::SafeArrayDestroy(m_pMembers); m_pMembers = NULL; } m_pMembers = GetDialog()->GetMembers(); m_aVarList.RemoveAll(); COperation::Init(); SetPouDT(TRUE); //TRUE for Insert (FALSE for Prop) }
void ribi::gtst::ParticipantDialogStateChooseAction::ShowPage(ParticipantDialog * const dialog) { assert(dialog); assert(GetDialog()->CanGetParticipant() && "Assume a logged in participant"); ui.m_button_choose_action = new Wt::WPushButton("Submit"); ui.m_group = new Wt::WButtonGroup(dialog); ui.m_label_status = new Wt::WLabel("Please choose an action."); ui.m_label_time_left = new Wt::WLabel("Time left: ... seconds"); assert(ui.m_button_choose_action); assert(ui.m_group); assert(ui.m_label_status); assert(ui.m_label_time_left); new Wt::WBreak(dialog); dialog->addWidget(ui.m_label_status); new Wt::WBreak(dialog); new Wt::WBreak(dialog); dialog->addWidget(ui.m_label_time_left); new Wt::WBreak(dialog); new Wt::WBreak(dialog); //ButtonGroup { Wt::WGroupBox * const container = new Wt::WGroupBox("Possible actions",dialog); const std::vector<boost::shared_ptr<ChooseActionOption> >& options = m_server->GetParameters()->GetChooseAction()->GetOptions(); const int n_options = boost::numeric_cast<int>(options.size()); //Add the RadioButtons for (int i=0; i!=n_options; ++i) { Wt::WRadioButton * const button = new Wt::WRadioButton( options[i]->GetDescription().c_str(), container); new Wt::WBreak(container); ui.m_group->addButton(button,i); } } new Wt::WBreak(dialog); new Wt::WBreak(dialog); dialog->addWidget(ui.m_button_choose_action); ui.m_button_choose_action->clicked().connect( this, &ribi::gtst::ParticipantDialogStateChooseAction::OnChooseActionClick); }
// a) Child dialog resize // b) Scroll bars handling at resize void CDialogScrollView::OnSize(UINT nType, int cx, int cy) { if (nType == SIZE_MINIMIZED) { return; } CDialog* pDlg = GetDialog(); if (pDlg != NULL) { pDlg->SetWindowPos(NULL, 0, 0, cx, cy, SWP_NOMOVE|SWP_NOZORDER|SWP_NOACTIVATE); CRect rect; GetClientRect(&rect); CRect totalRect; pDlg->GetClientRect(totalRect); SetScrollSizes(MM_TEXT, totalRect.Size(), rect.Size()); } CScrollView::OnSize(nType, cx, cy); }