예제 #1
0
파일: database.cpp 프로젝트: jerkey/kicad
/*
 * Displays a list of filtered components found in libraries for selection,
 * Keys is a list of keywords to filter components which do not match these keywords
 * If Keys is empty, list components that match BufName mask (with * and?)
 *
 * Returns the name of the selected component, or an empty string
 */
wxString DataBaseGetName( EDA_DRAW_FRAME* frame, wxString& Keys, wxString& BufName )
{
    std::vector<wxArrayString>  nameList;
    wxString       msg;

#ifndef KICAD_KEEPCASE
    BufName.MakeUpper();
#endif
    Keys.MakeUpper();

    /* Review the list of libraries for counting. */
    BOOST_FOREACH( CMP_LIBRARY& lib, CMP_LIBRARY::GetLibraryList() )
    {
        lib.SearchEntryNames( nameList, BufName, Keys );
    }
bool CDummyRepeaterFrame::processRpt2(wxString& rpt2)
{
	if (!rpt2.IsSameAs(UNUSED)) {
		rpt2.MakeUpper();

		// Check for the right length
		size_t len = rpt2.Length();
		if (len > LONG_CALLSIGN_LENGTH) {
			error(_("The RPT2 callsign is too long"));
			return false;
		}

		// Check for invalid characters
		size_t pos = rpt2.find_first_not_of(wxT("ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789/ "));
		if (pos != wxString::npos) {
			error(_("Invalid character in the RPT2 callsign"));
			return false;
		}

		// Add the RPT2 callsign to the list
		int index = m_rpt2->FindString(rpt2);
		if (index == wxNOT_FOUND)
			m_rpt2->Insert(rpt2, 0U);	// Insert at the top

		// Replace value with possibly modified versions
		m_rpt2->SetValue(rpt2);
	}

	::wxGetApp().setRpt2(rpt2);

	return true;
}
bool CDummyRepeaterFrame::processYour(wxString& your)
{
	your.MakeUpper();

	// Check for the right length
	size_t len = your.Length();
	if (len > LONG_CALLSIGN_LENGTH) {
		error(_("The YOUR callsign is too long"));
		return false;
	}

	// Check for invalid characters
	size_t pos = your.find_first_not_of(wxT("ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789/ "));
	if (pos != wxString::npos) {
		error(_("Invalid character in the YOUR callsign"));
		return false;
	}

	// Add the Your callsign to the list
	if (!your.IsSameAs(CQCQCQ)) {
		int index = m_your->FindString(your);
		if (index == wxNOT_FOUND)
			m_your->Insert(your, 0U);	// Insert at the top
	}

	// Replace value with possibly modified versions
	m_your->SetValue(your);

	::wxGetApp().setYour(your);

	return true;
}
예제 #4
0
int mxVarWindow::GetVarType (int &line, wxString var_name) {

	if (var_name.Contains("[")) var_name=var_name.BeforeFirst('[');
	var_name.MakeUpper();
	
	wxTreeItemIdValue cookie;
	wxTreeItemId it = tree->GetFirstChild(tree->GetRootItem(),cookie);
	while (it.IsOk()) {
		range *r=(range*)tree->GetItemData(it);
		if (/*r && */line>=r->from && line<=r->to) {
			line = r->from;
			break;
		}
		it = tree->GetNextSibling(it);
	}
	if (!it.IsOk()) return -1;
	it = tree->GetFirstChild(it,cookie);
	while (it.IsOk()) {
		wxString it_text = tree->GetItemText(it);
		if (it_text.Contains("[")) {
			if (it_text.BeforeFirst('[').Upper()==var_name) 
				return GetVarType(it);
		} else {
			if (it_text.Upper()==var_name) 
				return GetVarType(it);
		}
		it = tree->GetNextSibling(it);
	}
	return -1;
	
}
예제 #5
0
// 10個のプルダウン全て調べる
void WxSQLiteTest::ColumnPullDownSearcher(wxString& dataType, wxString& value)
{
	// それぞれのカラムを調べる
	if (!dataType.IsEmpty() && !value.IsEmpty()) {
		if (!dataType.Cmp(wxT("カラムを作らない")) == 0 && ColumnValidator(value)) {
			columnArray->Add(dataType);
			columnArray->Add(value.MakeUpper());
			wxMessageBox(dataType);
			wxMessageBox(value);
		}
	}
}
예제 #6
0
/*
 * Displays a list of filtered components found in libraries for selection,
 * Keys is a list of keywords to filter components which do not match these keywords
 * If Keys is empty, list components that match BufName mask (with * and?)
 *
 * Returns the name of the selected component, or an empty string
 */
wxString DataBaseGetName( EDA_DRAW_FRAME* frame, wxString& Keys, wxString& BufName )
{
    std::vector<wxArrayString>  nameList;
    wxString       msg;

//    BufName.MakeUpper();
    Keys.MakeUpper();

    /* Review the list of libraries for counting. */
    BOOST_FOREACH( PART_LIB& lib, PART_LIB::GetLibraryList() )
    {
        lib.SearchEntryNames( nameList, BufName, Keys );
    }
예제 #7
0
파일: font.cpp 프로젝트: catalinr/wxWidgets
static wxFontWeight ParseWeightString(wxString s)
{
    s.MakeUpper();

    if (s == "THIN") return wxFONTWEIGHT_THIN;
    if (s == "EXTRALIGHT" || s == "ULTRALIGHT") return wxFONTWEIGHT_EXTRALIGHT;
    if (s == "LIGHT") return wxFONTWEIGHT_LIGHT;
    if (s == "NORMAL") return wxFONTWEIGHT_NORMAL;
    if (s == "MEDIUM") return wxFONTWEIGHT_MEDIUM;
    if (s == "DEMIBOLD" || s == "SEMIBOLD") return wxFONTWEIGHT_SEMIBOLD;
    if (s == "BOLD") return wxFONTWEIGHT_BOLD;
    if (s == "EXTRABOLD" || s == "ULTRABOLD") return wxFONTWEIGHT_EXTRABOLD;
    if (s == "BLACK" || s == "HEAVY") return wxFONTWEIGHT_HEAVY;
    if (s == "EXTRAHEAVY") return wxFONTWEIGHT_EXTRAHEAVY;

    return wxFONTWEIGHT_NORMAL;
}
예제 #8
0
파일: format.cpp 프로젝트: bihai/fbide
inline int format::isKeyword(wxString kw) {
    kw=kw.MakeUpper();
    unsigned int kwlen=kw.Len();
    for(int i=0;i<4;i++) {
        int keywcount=(int)keyw[i].Count()-1;
        for(int j=0;j<keywcount-1;j++) {
            //check the lenght of the kw and keyw, if matxhes then
            //check first char as well.
            if (keyw[i][j].Len()==kwlen) {
                if(keyw[i][j].GetChar(0)==kw.GetChar(0)) {
                    if(keyw[i][j]==kw)
                        return i+1;
                }
            }
        }
    }
    return 0;
}
예제 #9
0
// This routine loads cheats from *.pnach files
// Returns number of cheats loaded
// Note: Should be called after InitPatches()
int LoadCheats(wxString name, const wxDirName& folderName, const wxString& friendlyName)
{
	int loaded = 0;
	int numberFoundCheatsFiles;

	wxString filespec = name + L"*.pnach";
	loaded += LoadCheatsFiles(folderName, filespec, friendlyName, numberFoundCheatsFiles);

	// This message _might_ be buggy. This function (LoadCheats) loads from an explicit folder.
	// This folder can be cheats or cheats_ws at either the default location or a custom one.
	// This check only tests the default cheats folder, so the message it produces is possibly misleading.
	if (folderName.ToString().IsSameAs(PathDefs::GetCheats().ToString()) && numberFoundCheatsFiles == 0) {
		wxString pathName = Path::Combine(folderName, name.MakeUpper() + L".pnach");
		PatchesCon->WriteLn(Color_Gray, L"Not found %s file: %s", WX_STR(friendlyName), WX_STR(pathName));
	}

	PatchesCon->WriteLn((loaded ? Color_Green : Color_Gray), L"Overall %d %s loaded", loaded, WX_STR(friendlyName));
	return loaded;
}
예제 #10
0
// This routine loads cheats from a zip file
// Returns number of cheats loaded
// Note: Should be called after InitPatches()
// Note: only load cheats from the root folder of the zip
int LoadCheatsFromZip(wxString gameCRC, const wxString& cheatsArchiveFilename) {
  gameCRC.MakeUpper();

  int before = cheatnumber;

  std::auto_ptr<wxZipEntry> entry;
  wxFFileInputStream in(cheatsArchiveFilename);
  wxZipInputStream zip(in);
  while (entry.reset(zip.GetNextEntry()), entry.get() != NULL)
  {
    wxString name = entry->GetName();
    name.MakeUpper();
    if (name.Find(gameCRC) == 0 && name.Find(L".PNACH")+6u == name.Length()) {
		PatchesCon->WriteLn(Color_Green, L"Loading patch '%s' from archive '%s'",
                         WX_STR(entry->GetName()), WX_STR(cheatsArchiveFilename));
      wxTextInputStream pnach(zip);
      while (!zip.Eof()) {
        inifile_processString(pnach.ReadLine());
      }
    }
  }
  return cheatnumber - before;
}
예제 #11
0
int wxGISAcceleratorTable::GetKeyCode(wxString sKeyCode)
{
	sKeyCode.MakeUpper();
	int Key;
	if(sKeyCode.Len() == 1)
		Key = (int)sKeyCode.GetChar(0);
	else
	{
		if(sKeyCode.Find(wxT("WXK_F")) != wxNOT_FOUND)
		{
			int num = wxAtoi(sKeyCode.Right(sKeyCode.Len() - 5)) - 1;
			Key = WXK_F1 + num;
		}
		else if(sKeyCode == wxString(wxT("WXK_DELETE")))
		{
			Key = WXK_DELETE;
		}
		else if(sKeyCode == wxString(wxT("WXK_NUMPAD_DELETE")))
		{
			Key = WXK_NUMPAD_DELETE;
		}
		else if(sKeyCode == wxString(wxT("WXK_ESCAPE")))
		{
			Key = WXK_ESCAPE;
		}
		else if(sKeyCode == wxString(wxT("WXK_SPACE")))
		{
			Key = WXK_SPACE;
		}
		else if(sKeyCode == wxString(wxT("WXK_NUMPAD_SPACE")))
		{
			Key = WXK_NUMPAD_SPACE;
		}
		else if(sKeyCode == wxString(wxT("WXK_RETURN")))
		{
			Key = WXK_RETURN;
		}
		else if(sKeyCode == wxString(wxT("WXK_EXECUTE")))
		{
			Key = WXK_EXECUTE;
		}
		else if(sKeyCode == wxString(wxT("WXK_PAUSE")))
		{
			Key = WXK_PAUSE;
		}
		else if(sKeyCode == wxString(wxT("WXK_END")))
		{
			Key = WXK_END;
		}
		else if(sKeyCode == wxString(wxT("WXK_NUMPAD_END")))
		{
			Key = WXK_NUMPAD_END;
		}
		else if(sKeyCode == wxString(wxT("WXK_HOME")))
		{
			Key = WXK_HOME;
		}
		else if(sKeyCode == wxString(wxT("WXK_NUMPAD_HOME")))
		{
			Key = WXK_NUMPAD_HOME;
		}
		else if(sKeyCode == wxString(wxT("WXK_INSERT")))
		{
			Key = WXK_INSERT;
		}
		else if(sKeyCode == wxString(wxT("WXK_NUMPAD_INSERT")))
		{
			Key = WXK_NUMPAD_INSERT;
		}
	}
	return Key;
}