void InsertCommandString( void *theEnv, const char *str, unsigned int position) { CommandLineData(theEnv)->CommandString = InsertInString(theEnv,str,position,CommandLineData(theEnv)->CommandString, &RouterData(theEnv)->CommandBufferInputCount,&CommandLineData(theEnv)->MaximumCharacters); }
void CPlaceInternalPunct::OnButtonPlace(wxCommandEvent& WXUNUSED(event)) { long nStart; long nEnd; m_ptgtPhraseBox->GetSelection(&nStart,&nEnd); //int len = m_tgtPhrase.Length(); // BEW 5Mar15 comment out this test and message. Working with Sally Barton in Canberra it was // a problem, she had a single word translation and the source text was 3 words with comma after // the first word, and this test prevented comma placement at the end of the single world. It's // better to allow the placement be anywhere, and if at the end and there is stored ending punctuation // which is different, the placed one is given preference - that's consistent with how things behave // elsewhere in the app, so that's what we do now //if (nEnd > len || nEnd < 0 || nEnd == 0 || nEnd == len ) //{ // IDS_WRONG_PASTE_LOCATION // wxMessageBox(_("Sorry, within this dialog it is an error to place phrase medial punctuation at the beginning or end of a phrase."),_T(""), wxICON_INFORMATION | wxOK); // return; //} // must not allow a selection to cause loss of data, so to be safe // we remove any selection the user might have left in the box if (nEnd != nStart) { nStart = nEnd; } m_ptgtPhraseBox->SetSelection(nStart,nEnd); int strLen = 1; // default - we place something! if (m_pListPunctsBox->GetCount() == 0) { nEnd = 0; goto a; } { if (!ListBoxPassesSanityCheck((wxControlWithItems*)m_pListPunctsBox)) { // message can be in English, it's never likely to occur wxMessageBox(_T("List box error when getting the current selection, Adaptit will do nothing."), _T(""), wxICON_EXCLAMATION | wxOK); return; } int nSel; nSel = m_pListPunctsBox->GetSelection(); //if (nSel == -1) //LB_ERR //{ // // message can be in English, it's never likely to occur // wxMessageBox(_T("List box error when getting the current selection, Adaptit will do nothing."), // _T(""), wxICON_EXCLAMATION); // return; //} // get the selected string wxString str; str = m_pListPunctsBox->GetStringSelection(); // the list box punctuation at wherever selection is wxString target = m_tgtPhrase; // copy of the box's string m_pListPunctsBox->Delete(nSel); if (m_pListPunctsBox->GetCount() > 0) m_pListPunctsBox->SetSelection(0,TRUE); // get the next one ready for placing strLen = str.Length(); // put the punctuation at the cursor location & update the dialog target = InsertInString(target,(int)nEnd,str); m_tgtPhrase = target; } a: m_ptgtPhraseBox->SetValue(m_tgtPhrase); // keep the box contents agreeing with the modified string m_ptgtPhraseBox->SetFocus(); m_ptgtPhraseBox->SetSelection(nEnd+strLen,nEnd+strLen); }