void frmDatabaseDesigner::OnAddDiagram(wxCommandEvent &event) { wxString newName = wxGetTextFromUser(_("New Diagram Name"), _("Diagram Name"), _("unnamed"), this); if (!newName.IsEmpty()) { diagrams->AddPage(design->createDiagram(diagrams, newName, false)->getView(), newName); setModelChanged(true); } UpdateToolbar(); }
/* * buttonNewsAddClick */ void panelAdmin::buttonNewsAddClick(wxCommandEvent& event) { string Message; Message = (const char *) wxGetTextFromUser( wxT("Enter your news"), wxT("New News" )).mb_str(wxConvUTF8); if( Message.size() < 5 ) { wxMessageBox( wxT("Minimum of 5 characters for the news")); return; } _mainApp->serverGet()->moduleGet< moduleMessages >( modMESSAGES )->newsNew( Message ); }
void HTMLButcherAssortedFileGroupsDialog::do_add() { wxString groupname=wxGetTextFromUser(_("Group name"), _("Add Assorted File Group"), wxEmptyString, this); if (!groupname.IsEmpty()) { ButcherProjectBaseAutoUpdate upd(GetProject()); unsigned long newid=GetProject()->AssortedFileGroups().Add(groupname); item_add(make_description(GetProject()->AssortedFileGroups().Get(newid)), newid); } }
void MyFrame::OnSetArgs(wxCommandEvent& event) { wxString args = wxGetTextFromUser(_T("Please enter command line arguments"), _T("MakeSplash"), wxGetApp().m_cmdLine); if (!args.IsEmpty()) { wxGetApp().SetDefaults(); wxGetApp().m_cmdLine = args; wxGetApp().m_parser.SetCmdLine(wxGetApp().m_cmdLine); wxGetApp().ProcessCommandLine(this); } }
void mmCategDialog::OnEdit(wxCommandEvent& /*event*/) { if (selectedItemId_ == root_ || !selectedItemId_) return; const wxString& old_name = m_treeCtrl->GetItemText(selectedItemId_); const wxString& msg = wxString::Format(_("Enter a new name for %s"), old_name); const wxString text = wxGetTextFromUser(msg , _("Edit Category"), m_textCtrl->GetValue()); if (text.IsEmpty()) return; m_textCtrl->SetValue(text); mmTreeItemCateg* iData = dynamic_cast<mmTreeItemCateg*> (m_treeCtrl->GetItemData(selectedItemId_)); if (iData->getSubCategData()->SUBCATEGID == -1) // not subcateg { Model_Category::Data_Set categories = Model_Category::instance().find(Model_Category::CATEGNAME(text)); if (!categories.empty()) { wxString errMsg = _("Category with same name exists"); wxMessageBox(errMsg, _("Organise Categories: Editing Error"), wxOK | wxICON_ERROR); return; } Model_Category::Data* category = iData->getCategData(); category->CATEGNAME = text; Model_Category::instance().save(category); mmWebApp::MMEX_WebApp_UpdateCategory(); } else { Model_Category::Data* category = iData->getCategData(); const auto &subcategories = Model_Category::sub_category(category); for (const auto &entry : subcategories) { if (entry.SUBCATEGNAME == text) { wxString errMsg = _("Sub Category with same name exists"); wxMessageBox(errMsg, _("Organise Categories: Editing Error"), wxOK | wxICON_ERROR); return; } } Model_Subcategory::Data* sub_category = iData->getSubCategData(); sub_category->SUBCATEGNAME = text; Model_Subcategory::instance().save(sub_category); mmWebApp::MMEX_WebApp_UpdateCategory(); } m_treeCtrl->SetItemText(selectedItemId_, text); refreshRequested_ = true; }
void HTMLButcherMasksDialog::do_duplicate(unsigned long id) { wxString newname=wxGetTextFromUser(_("New mask name"), _("Duplicate mask"), wxEmptyString, this); if (!newname.IsEmpty()) { ButcherProjectBaseAutoUpdate upd(GetProject()); BLID_t newid=GetProject()->Masks().Duplicate(id, newname); item_add(make_description(GetProject()->Masks().Get(newid)), newid); } }
void MyFrame::OnPlay(wxCommandEvent& WXUNUSED(event)) { wxString str = wxGetTextFromUser ( _("Enter your number:"), _("Try to guess my number!"), wxEmptyString, this ); if ( str.empty() ) { // cancelled return; } long num; if ( !str.ToLong(&num) || num < 0 ) { str = _("You've probably entered an invalid number."); } else if ( num == 9 ) { // this message is not translated (not in catalog) because we used wxT() // and not _() around it str = wxT("You've found a bug in this program!"); } else if ( num == 17 ) { str.clear(); // string must be split in two -- otherwise the translation would't be // found str << _("Congratulations! you've won. Here is the magic phrase:") << _("cannot create fifo `%s'"); } else { // this is a more implicit way to write _() but note that if you use it // you must ensure that the strings get extracted in the message // catalog as by default xgettext won't do it; it only knows of _(), // not of wxTRANSLATE(). As internat's readme.txt says you should thus // call xgettext with -kwxTRANSLATE. str = wxGetTranslation(wxTRANSLATE("Bad luck! try again...")); // note also that if we want 'str' to contain a localized string // we need to use wxGetTranslation explicitly as wxTRANSLATE just // tells xgettext to extract the string but has no effect on the // runtime of the program! } wxMessageBox(str, _("Result"), wxOK | wxICON_INFORMATION); }
void frmDatabaseDesigner::OnRenameDiagram(wxCommandEvent &event) { hdDrawingView *view = (hdDrawingView *) diagrams->GetPage(diagrams->GetSelection()); int diagramIndex = view->getIdx(); wxString name = wxGetTextFromUser(_("Rename diagram ") + diagrams->GetPageText(diagramIndex) + _(" to:"), _("Rename diagram..."), diagrams->GetPageText(diagramIndex), this); if(!name.IsEmpty() && !name.IsSameAs(diagrams->GetPageText(diagramIndex), false)) { view->getDrawing()->setName(name); diagrams->SetPageText(diagramIndex, name); setModelChanged(true); } }
void MainFrame::on_rename_file(wxCommandEvent& WXUNUSED(event)) { MetalinkFile file = editor_.get_file(); wxString filename = wxGetTextFromUser( wxT("Please enter a file name:"), wxT("Rename file"), file.get_filename() ); if(filename == wxT("")) return; file.set_filename(filename); editor_.set_file(file); }
bool hdSimpleTextTool::callDialog(hdDrawingView *view) { wxString sNewValue = wxGetTextFromUser(dlgMessage, dlgCaption, txtFigure->getText(), view); if (!sNewValue.IsEmpty()) { txtFigure->setText(sNewValue); view->notifyChanged(); return true; } else return false; }
void ProjectsFileMasksDlg::OnEdit(wxCommandEvent& /*event*/) { wxListBox* pList = XRCCTRL(*this, "lstCategories", wxListBox); wxString oldName = pList->GetStringSelection(); wxString groupName = wxGetTextFromUser(_("Rename the group:"), _("Edit group"), oldName); if (!groupName.IsEmpty() && groupName != oldName) { m_FileGroupsAndMasksCopy.RenameGroup(pList->GetSelection(), groupName); pList->SetString(pList->GetSelection(), groupName); } }
// Go to move... menu command void SimpleGoFrame::GoToMove(wxCommandEvent& event) { panel->gnugopause = true; wxString input = wxGetTextFromUser(wxString::Format("Enter the move number to go to, between 0 and %d:", panel->totmove), "Go to move", ""); if(!input.IsSameAs("")) { int num = wxAtoi(input); if(num>=0 && num<=panel->totmove) { panel->gnugopause = true; panel->gnugoscore = false; panel->curmove = num; panel->UpdateBoard(); } } }
void ProjectsFileMasksDlg::OnAdd(wxCommandEvent& /*event*/) { wxString groupName = wxGetTextFromUser(_("Enter the new group name:"), _("New group")); if (groupName.IsEmpty()) return; m_FileGroupsAndMasksCopy.AddGroup(groupName); wxListBox* pList = XRCCTRL(*this, "lstCategories", wxListBox); pList->Append(groupName); pList->SetSelection(pList->GetCount() - 1); ListChange(); XRCCTRL(*this, "txtFileMasks", wxTextCtrl)->SetFocus(); }
void MyFrame::OnHostname( wxCommandEvent& WXUNUSED(event) ) { if (GetHostname()->GetStringSelection() == wxT("...")) { wxString s = wxGetTextFromUser(wxT("Specify the name of the host (ignored under DDE)"), wxT("Host Name"), wxEmptyString, this); if (!s.IsEmpty() && s != IPC_HOST) { GetHostname()->Insert(s, 0); GetHostname()->SetSelection(0); } } }
void MyFrame::OnTopic( wxCommandEvent& WXUNUSED(event) ) { if (GetTopic()->GetStringSelection() == wxT("...")) { wxString s = wxGetTextFromUser(wxT("Specify the name of the topic"), wxT("Topic Name"), wxEmptyString, this); if (!s.IsEmpty() && s != IPC_TOPIC) { GetTopic()->Insert(s, 0); GetTopic()->SetSelection(0); } } }
void MyFrame::OnServername( wxCommandEvent& WXUNUSED(event) ) { if (GetServername()->GetStringSelection() == wxT("...")) { wxString s = wxGetTextFromUser(wxT("Specify the name of the server"), wxT("Server Name"), wxEmptyString, this); if (!s.IsEmpty() && s != IPC_SERVICE) { GetServername()->Insert(s, 0); GetServername()->SetSelection(0); } } }
void ConfigDialog::OnLibraryPathsDClick(wxCommandEvent& event) { wxString def = listLibraryPaths->GetStringSelection(); wxString path = wxGetTextFromUser("Enter path:", "Library", def, this); if (!path.IsEmpty()) { if (listLibraryPaths->GetSelection() >= 0) { listLibraryPaths->SetString(listLibraryPaths->GetSelection(), path); } } }
/* TextureXPanel::newTexture * Creates a new, empty texture *******************************************************************/ void TextureXPanel::newTexture() { // Prompt for new texture name string name = wxGetTextFromUser("Enter a texture name:", "New Texture"); // Do nothing if no name entered if (name.IsEmpty()) return; // Process name name = name.Upper().Truncate(8); // Create new texture CTexture* tex = new CTexture(); tex->setName(name); tex->setState(2); // Default size = 64x128 tex->setWidth(64); tex->setHeight(128); // Setup texture scale if (texturex.getFormat() == TXF_TEXTURES) { tex->setScale(1, 1); tex->setExtended(true); } else tex->setScale(0, 0); // Add it after the last selected item int selected = list_textures->getLastSelected(); if (selected == -1) selected = texturex.nTextures() - 1; // Add to end of the list if nothing selected texturex.addTexture(tex, selected + 1); // Record undo level undo_manager->beginRecord("New Texture"); undo_manager->recordUndoStep(new TextureCreateDeleteUS(this, tex, true)); undo_manager->endRecord(true); // Update texture list list_textures->updateList(); // Select the new texture list_textures->clearSelection(); list_textures->selectItem(selected + 1); list_textures->EnsureVisible(selected + 1); // Update variables modified = true; }
void MyFrame::OnGotoLine (wxCommandEvent& WXUNUSED(event)) { if (stc==0) return; wxString lineString = wxGetTextFromUser(_(Lang[221]), _(Lang[222]), _(""), this); //Go To Line Number: \ Go To Line if (lineString.IsEmpty()) return; if (lineString.Contains(":")) { wxString line, col; line = lineString.BeforeFirst(':'); col = lineString.AfterFirst(':'); if ((line.IsNumber() || line == "e") && (col.IsNumber() || col == "e")) { long lineNumber, colNumber; if (line.IsNumber()) line.ToLong(&lineNumber); else lineNumber = stc->GetLineCount(); lineNumber--; if (col.IsNumber()) { col.ToLong(&colNumber); colNumber--; } else colNumber = stc->GetLineEndPosition(lineNumber) - stc->PositionFromLine(lineNumber); if (lineNumber >= 0 && lineNumber < stc->GetLineCount()) stc->GotoLine(lineNumber); if (colNumber >= 0 && colNumber <= stc->GetLineEndPosition(lineNumber) - stc->PositionFromLine(lineNumber)) stc->GotoPos(stc->GetCurrentPos() + colNumber); } } else if (lineString == "e") stc->GotoLine(stc->GetLineCount() - 1); else if (lineString.IsNumber()) { long lineNumber; lineString.ToLong(&lineNumber); lineNumber--; if (lineNumber >= 0 && lineNumber <= stc->GetLineCount()) stc->GotoLine(lineNumber); } }
void PathBehaviorEditor::OnpreviewPnlRightUp(wxMouseEvent& event) { int selectedPoint; if((selectedPoint = GetPointOnMouse(event)) != -1) { if(previewPnlState.state == NOTHING) { int menuSelection = previewPnl->GetPopupMenuSelectionFromUser(pointMenu, event.GetPosition()); if(menuSelection == coordsBtID) { wxMessageBox(_("Point position:") + gd::String::From(path->at(selectedPoint).x) + ";" + gd::String::From(path->at(selectedPoint).y)); } else if(menuSelection == positionBtID) { int posX = gd::String(wxGetTextFromUser(_("X position:"), _("Position precisely"), gd::String::From(path->at(selectedPoint).x), this)).To<int>(); int posY = gd::String(wxGetTextFromUser(_("Y position:"), _("Position precisely"), gd::String::From(path->at(selectedPoint).y), this)).To<int>(); path->at(selectedPoint).x = posX; path->at(selectedPoint).y = posY; } else if(menuSelection == addPointAfterBtID) { if(selectedPoint < (path->size() - 1)) { path->insert(path->begin() + selectedPoint + 1, sf::Vector2f((path->at(selectedPoint) + path->at(selectedPoint + 1)) / 2.f)); } } else if(menuSelection == removePointBtID) { path->erase(path->begin() + selectedPoint); } } previewPnl->Refresh(); previewPnl->Update(); } }
void QMakeSettingsDlg::OnRename(wxCommandEvent& event) { if ( m_rightClickTabIdx != wxNOT_FOUND ) { wxString qmakeSettingsName = m_notebook->GetPageText( (size_t) m_rightClickTabIdx ); wxString newName = wxGetTextFromUser(_("New name:"), _("Rename...")); if ( newName.empty() == false ) { QmakeSettingsTab *tab = dynamic_cast<QmakeSettingsTab*>(m_notebook->GetPage(m_rightClickTabIdx)); if (tab) { tab->SetTabName( newName ); m_notebook->SetPageText( (size_t) m_rightClickTabIdx, newName ); } } } }
bool FilterCompressor::Prepare(WaveTrack *t, double t0, double t1, sampleCount total) { wxString temp; wxWindow *parent = NULL; temp = wxGetTextFromUser("Please enter an increment (in milliseconds) to apply the filter to", "Increment: ","1", parent, -1, -1, TRUE); if(temp == "") return false; while (sscanf((const char *)temp, "%d", &increment) < 0) { temp = wxGetTextFromUser("Please enter a value greater than zero:", "Increment: ", "1", parent, -1, -1, TRUE); if (temp == "") return false; } how_far = 0; increment *= t->rate / 100; return true; }
void UserWizardP2::OnAddNet(wxCommandEvent &event) { wxListCtrl * listctrl = (wxListCtrl *)FindWindow(ID_U_CONFNETS); wxListBox * listbox = (wxListBox *)FindWindow(ID_U_ALLNETS); if (listbox->GetSelection() < 0) return; wxString prompt(wxT("What is your ")); if (listbox->GetStringSelection() == wxT("ICQ")) prompt += wxT("UIN\non ICQ Network"); else { prompt += wxT(" screen-name\non "); prompt += listbox->GetStringSelection(); prompt += wxT(" Network?"); } wxString screenname = wxGetTextFromUser(prompt, wxT("Contact Information"),wxT(""), this); if (screenname.IsEmpty()) return; long fingstr = listctrl->FindItem(-1, screenname); if (fingstr >= 0) { if (listctrl->GetItemData(fingstr) == listbox->GetSelection()) { wxMessageBox(wxT("Sorry, you can't have the same name/network twice."), wxT("Duplicate Info"), wxOK, this); return; } } wxString prompt2(wxT("Please enter the password for ")); prompt2 += screenname; prompt2 += wxT(" on network "); prompt2 += listbox->GetStringSelection(); wxString pw = wxGetPasswordFromUser(prompt2); m_pwords.insert(m_pwords.begin(), SecByteBlock((const unsigned char *)pw.c_str(), pw.length())); //pw = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"; listctrl->InsertItem(0, screenname); listctrl->SetItemData(0, listbox->GetSelection()); listctrl->SetItem(0,1, listbox->GetStringSelection()); }
void RAIN::GUI::ChatMain::OnConnect(wxCommandEvent &e) { wxString addr = wxGetTextFromUser(wxT("Enter address:"), wxT("Connect Peer")); if (addr == wxEmptyString) return; if (!addr.Contains(wxT(":"))) { addr.Append(wxT(":1322")); } this->app->connections->ConnectPeer(addr); }
/* PaletteEntryPanel::testPalette * A "lite" version of addCustomPalette, which does not add to the * palette folder so the palette is only available for the current * session. *******************************************************************/ bool PaletteEntryPanel::testPalette() { // Get name to export as string name = "Test: " + wxGetTextFromUser("Enter name for Palette:", "Test Palettes"); // Add to palette manager and main palette chooser Palette8bit* pal = new Palette8bit(); pal->copyPalette(palettes[cur_palette]); thePaletteManager->addPalette(pal, name); thePaletteChooser->addPalette(name); thePaletteChooser->selectPalette(name); return true; }
int wxFileDialog::ShowModal() { wxWindow* parentWindow = GetParent(); if (!parentWindow) parentWindow = wxTheApp->GetTopWindow(); wxString str = wxGetTextFromUser(m_message, _("File"), m_fileName, parentWindow); if (str.empty()) return wxID_CANCEL; m_fileName = str; m_fileNames.Add(str); return wxID_OK; }
void SearchHelp(wxWindow * parent) { InitHelp(parent); if (gHelp) { wxString key = wxGetTextFromUser(_("Search for?"), _("Search help for keyword"), "", parent); if (!key.IsEmpty()) gHelp->KeywordSearch(key); } }
void ctCustomPropertyDialog::OnPropertyChoiceAdd( wxCommandEvent& WXUNUSED(event) ) { if(m_customPrototype) { if ( m_customPropertyEditorType->GetSelection() > -1 && m_customPropertyEditorType->GetStringSelection() == wxT("choice") ) { wxString str = wxGetTextFromUser(_T("New choice"), _("Add choice")); if (!str.empty() && m_propertyChoices) { m_propertyChoices->Append(str); m_choices.Add(str); } } } }
bool executeExpressionWindow(wxWindow* parent, DebugInterface* cpu, u64& dest, const wxString& defaultValue) { wxString result = wxGetTextFromUser(L"Enter expression",L"Expression",defaultValue,parent); if (result.empty()) return false; wxCharBuffer expression = result.ToUTF8(); if (parseExpression(expression, cpu, dest) == false) { displayExpressionError(parent); return false; } return true; }
/* PatchTablePanel::onBtnAddPatch * Called when the 'New Patch' button is clicked *******************************************************************/ void PatchTablePanel::onBtnAddPatch(wxCommandEvent& e) { // Prompt for new patch name string patch = wxGetTextFromUser("Enter patch entry name:", "Add Patch", wxEmptyString, this); // Check something was entered if (patch.IsEmpty()) return; // Add to patch table patch_table->addPatch(patch); // Update list list_patches->updateList(); parent->pnamesModified(true); }