void Determine_QM_Level(char szQMLevel[]) { char ErrorMsg[256]; if(FindString(szQMLevel, "HF") >= 0) { QM_Level = QM_LEVEL_HF; } else if(FindString(szQMLevel, "MP2") >= 0) { QM_Level = QM_LEVEL_MP2; } else { sprintf(ErrorMsg, "Fail to determine the QM level.\n%s\nQuit\n", szQMLevel); Quit_With_Error_Msg(ErrorMsg); } return; }
void OptionPage::OptionChoice(wxFlexGridSizer *flex, const wxString &name, const wxArrayString &choices, const char *opt_name) { parent->AddChangeableOption(opt_name); const auto opt = OPT_GET(opt_name); auto cb = new wxComboBox(this, -1, wxEmptyString, wxDefaultPosition, wxDefaultSize, choices, wxCB_READONLY | wxCB_DROPDOWN); Add(flex, name, cb); switch (opt->GetType()) { case agi::OptionType::Int: { int val = opt->GetInt(); cb->Select(val < (int)choices.size() ? val : 0); cb->Bind(wxEVT_COMBOBOX, IntCBUpdater(opt_name, parent)); break; } case agi::OptionType::String: { wxString val(to_wx(opt->GetString())); if (cb->FindString(val) != wxNOT_FOUND) cb->SetStringSelection(val); else if (!choices.empty()) cb->SetSelection(0); cb->Bind(wxEVT_COMBOBOX, StringUpdater(opt_name, parent)); break; } default: throw agi::InternalError("Unsupported type"); } }
/* ** Vers. 1.1 ** NEW: CopyList() */ void CACListWnd::CopyList() { m_DisplayList.Copy(m_SearchList); m_lCount = (long)m_DisplayList.GetSize(); if(m_lCount) FindString(0,_T(""),true); }
int To_Find_Tag(FILE *fIn, char szFileName[], char szTag[], char szLine[]) { char *ReadLine, ErrorMsg[256]; while(1) { if(feof(fIn)) { sprintf(ErrorMsg, "Fail to find the tag: %s in file %s\nQuit\n", szTag, szFileName); fclose(fIn); Quit_With_Error_Msg(ErrorMsg); } ReadLine = fgets(szLine, 256, fIn); if(ReadLine == NULL) { sprintf(ErrorMsg, "Fail to find the tag: %s in file %s\nQuit\n", szTag, szFileName); fclose(fIn); Quit_With_Error_Msg(ErrorMsg); } else { if(FindString(szLine, szTag) >= 0) { return 1; } } } return 0; }
bool wxBitmapComboBox::Create(wxWindow *parent, wxWindowID id, const wxString& value, const wxPoint& pos, const wxSize& size, int n, const wxString choices[], long style, const wxValidator& validator, const wxString& name) { if ( !wxComboBox::Create(parent, id, value, pos, size, n, choices, style, validator, name) ) return false; // Select 'value' in entry-less mode if ( !GetEntry() ) { int i = FindString(value); if (i != wxNOT_FOUND) SetSelection(i); } return true; }
virtual void SetStringValue(const wxString& s) { if (s.Length() > 0) { // Search item index int index = FindString(s); // Removes item if already in combos box if ( index != wxNOT_FOUND ) { Delete(index); } // Removes last item if max nb item is reached if ( GetCount() >= m_MaxHistoryLen) { // Removes last one Delete(GetCount()-1); } // Adds it to combos Insert(s, 0); Select(0); } }
void FStringTable::SetString (const char *name, const char *newString) { StringEntry **pentry, *oentry; FindString (name, pentry, oentry); size_t newlen = strlen (newString); size_t namelen = strlen (name); // Create a new string entry StringEntry *entry = (StringEntry *)M_Malloc (sizeof(*entry) + newlen + namelen + 2); strcpy (entry->String, newString); strcpy (entry->Name = entry->String + newlen + 1, name); entry->PassNum = 0; // If this is a new string, insert it. Otherwise, replace the old one. if (oentry == NULL) { entry->Next = *pentry; *pentry = entry; } else { *pentry = entry; entry->Next = oentry->Next; M_Free (oentry); } }
LONG CSizeComboBox::GetHeight(int sel) { if (sel == -1) sel = GetCurSel(); if (sel == -1) { TCHAR szText[20]; GetWindowText(szText, 20); sel = FindString( -1, szText); if (sel == CB_ERR) { CY cyTmp; cyTmp.Lo = 0; cyTmp.Hi = 0; _AfxCyFromString(cyTmp, szText); int PointSize = (int)((cyTmp.Lo + 5000) / 10000); if (PointSize != 0) return MulDiv(-afxData.cyPixelsPerInch, PointSize, 72); else sel = 0; } } return (LONG) GetItemData(sel); }
int CFontComboBox::AddFont(LOGFONT *pLF, DWORD FontType) { int nEntry; FONTITEM_PPG* pFontItem = NULL; // Font already in the combobox if (FindString(-1, (LPCTSTR) pLF->lfFaceName) != CB_ERR) return CB_ERR; // allocate some memory for the FONTITEM_PPG structure TRY { pFontItem = new FONTITEM_PPG; } CATCH( CMemoryException, e ) { return CB_ERR; } END_CATCH ASSERT( pFontItem ); pFontItem->lf = *pLF; pFontItem->dwFontType = FontType; nEntry = AddString( (LPCTSTR) pFontItem->lf.lfFaceName ); if (nEntry == CB_ERR) delete pFontItem; else SetItemData( nEntry, (DWORD) pFontItem ); return nEntry; }
const char* PSettings::GetString(const char *name) { const char *old; status_t s=FindString(name,&old); return old; }
void wxListBoxBase::SetFirstItem(const wxString& s) { int n = FindString(s); wxCHECK_RET( n != wxNOT_FOUND, wxT("invalid string in wxListBox::SetFirstItem") ); DoSetFirstItem(n); }
bool Preferences::ReadString(BString &string, const char* name) { Lock(); bool loaded = FindString(name, &string) == B_OK; Unlock(); return loaded; }
void CLocalComboBox::SetTheText(LPCTSTR lpszText,BOOL bMatchExact) { int idx = (bMatchExact) ? FindStringExact(-1,lpszText) : FindString(-1, lpszText); SetCurSel( (idx==CB_ERR) ? -1 : idx); if (idx == CB_ERR) SetWindowText(lpszText); }
int ctlComboBox::GetGuessedSelection() const { int sel=GetCurrentSelection(); if (sel < 0) sel = FindString(GetValue()); return sel; }
DWORD CItemList::FindString(LPCTSTR pCol, LPCTSTR pStr) { // Get column index DWORD i = GetHeader().FindCol( pCol ); if ( i == MAXDWORD ) return i; return FindString( i, pStr ); }
C4String *C4StringTable::RegString(StdStrBuf String) { C4String * s = FindString(String.getData()); if (s) return s; else return new C4String(String); }
/*! \brief Returns the name of the set \return The name of the set */ const char * CursorSet::GetName(void) { const char *name; if (FindString("name", &name) == B_OK) return name; return NULL; }
int color_combo_box::SetCurSelNEW(int model_index) { if((model_index < 0) || (model_index >= Num_ship_types)){ return SetCurSel(model_index); } // lookup the ship name return FindString(0, Ship_info[model_index].name); }
void PSettings::SetString(const char *name,const char *text) { const char *old; status_t s=FindString(name,&old); if(s==B_OK)ReplaceString(name,text); else AddString(name,text); }
/* ======================== idLangDict::GetString ======================== */ const char* idLangDict::GetString( const char* str ) const { const char* localized = FindString( str ); if( localized == NULL ) { return str; } return localized; }
BString AttributeMessage::GetAttribute(const char* name, const BString& defaultValue) const { BString value; if (FindString(name, &value) != B_OK) return defaultValue; return value; }
myinline const char* ArpMessage::GetString(const char *name, const char* def, int32 index) const { if( this ) { const char* res; if( FindString(name, index, &res) != B_NO_ERROR ) return def; return res; } return def; }
const char *Config::GetString(const char *name, const char *Default) { const char *str; if (FindString(name, &str) == B_OK) return str; else return Default; }
bool wxItemContainerImmutable::SetStringSelection(const wxString& s) { const int sel = FindString(s); if ( sel == wxNOT_FOUND ) return false; SetSelection(sel); return true; }
bool wxListBoxBase::SetStringSelection(const wxString& s, bool select) { int sel = FindString(s); wxCHECK_MSG( sel != wxNOT_FOUND, false, wxT("invalid string in SetStringSelection") ); SetSelection(sel, select); return true; }
const char * GetBoundaryEnd(const char *startSearch, const char *endSearch, string boundary) { if (endSearch <= startSearch || endSearch == 0 || startSearch == 0 || boundary.length() == 0) { assert(0); return 0; } const char* possibleEnding = FindString(startSearch, boundary.c_str(), endSearch); int counter = 1000; while (possibleEnding != 0 && counter > 0) { counter--; // return if the string after the boundary is either a newline, or a --. // this is to prevent the problem that we return incorrect boundaries // if the boundary string is a part of another boundary string. int sizeRemainingAfterBoundaryString = endSearch - possibleEnding; if (sizeRemainingAfterBoundaryString <= 2) { // malformed message. the end of the character string is the boundary line with no trailing crlf or --. assert(0); return 0; } if ((possibleEnding[boundary.size()] == '-' && possibleEnding[boundary.size()+1] == '-') || (possibleEnding[boundary.size()] == '\r' && possibleEnding[boundary.size()+1] == '\n')) { return possibleEnding; } // false. try again. possibleEnding = FindString(possibleEnding+1, boundary.c_str(), endSearch); } assert(0); return 0; }
bool wxRadioBox::SetStringSelection( const wxString &s ) { wxCHECK_MSG( m_widget != NULL, false, wxT("invalid radiobox") ); int res = FindString( s ); if (res == wxNOT_FOUND) return false; SetSelection( res ); return true; }
int ReplaceSubList::DeleteString(wchar_t *old) { int i = FindString(old); if (i < 0) return 0; free(strings[i].old); for (int j=i+1; j<numStrings; j++) strings[j-1] = strings[j]; numStrings--; return 1; }
int NFCRecord::FindString(const std::string& strColTag, const std::string& value, NFDataList& varResult) { if (strColTag.empty()) { return -1; } int nCol = GetCol(strColTag); return FindString(nCol, value, varResult); }
bool wxListBoxBase::SetStringSelection(const wxString& s, bool select) { const int sel = FindString(s); if ( sel == wxNOT_FOUND ) return false; SetSelection(sel, select); return true; }