Exemplo n.º 1
0
/* ------------------------------------------------------------------------------------------------------------------
*  Write and read values
*  Regardless of namespaces, the string keys app_path and data_path always refer to the location of the application's executable
*  and the data path, respectively. These values are never saved to the configuration, but kept in static variables.
*  The application makes use of this by "writing" to the configuration file after determining these values at runtime.
*/
void ConfigManager::Write(const wxString& name,  const wxString& value, bool ignoreEmpty)
{
    if (name.IsSameAs(CfgMgrConsts::app_path))
    {
        return;
    }
    else if (name.IsSameAs(CfgMgrConsts::data_path))
    {
        data_path_global = value;
        return;
    }
    if (ignoreEmpty && value.IsEmpty())
    {
        UnSet(name);
        return;
    }

    wxString key(name);
    TiXmlElement* e = AssertPath(key);

    TiXmlElement *str = GetUniqElement(e, key);

    TiXmlElement *s = GetUniqElement(str, _T("str"));

    TiXmlText t(value.mb_str(wxConvUTF8));
    t.SetCDATA(true);
    SetNodeText(s, t);
}
Exemplo n.º 2
0
bool ConfigManager::Read(const wxString& name, wxString* str)
{
    if (name.IsSameAs(CfgMgrConsts::app_path))
    {
        str->assign(app_path);
        return true;
    }
    else if (name.IsSameAs(CfgMgrConsts::data_path))
    {
        str->assign(data_path_global);
        return true;
    }

    wxString key(name);
    TiXmlElement* e = AssertPath(key);

    TiXmlHandle parentHandle(e);
    TiXmlText *t = (TiXmlText *) parentHandle.FirstChild(cbU2C(key)).FirstChild("str").FirstChild().Node();

    if (t)
    {
        str->assign(cbC2U(t->Value()));
        return true;
    }
    return false;
}
Exemplo n.º 3
0
bool MerryController::ShellExecute(const wxString& commandName,
	const wxString& commandArg,
	const wxString& workingDir,
	const wxString& show) const
{
	// wxLogNull logNo;
	wxString cmdName = commandName;
	int showCommand = SW_SHOW;
	bool runas = false;
	if (show.IsSameAs(wxT("hide"), false))
		showCommand = SW_HIDE;
	else if (show.IsSameAs(wxT("min"), false))
		showCommand = SW_SHOWMINIMIZED;
	else if (show.IsSameAs(wxT("max"), false))
		showCommand = SW_SHOWMAXIMIZED;

	while(true)
	{
		UCHAR T = cmdName.GetChar(0).GetValue();
		if (T == '@')//前导'@'隐藏窗口运行
			showCommand = SW_HIDE;
		else if (T == '*')//前导'*' NT6以上请会管理员权限,NT5运行为
			runas = true;
		else if (T == '>')//前导'>'请求管理员权限(NT6以上有效)
		{
			if (::wxGetWinVersion() >= wxWinVersion_6)
				runas = true;
		}
		else
			break;
		cmdName.erase(0,1);
	}
	if (!LocationExec)
	{
		__DEBUG_BEGIN(cmdName.c_str());
		int ret = (int)::ShellExecute(NULL,(runas?_T("RunAs"):NULL), cmdName.c_str(), commandArg.c_str(), workingDir.c_str(), showCommand);
		if (ret > 32)
			return true;
		__DEBUG_BEGIN(wxString::Format("cmd.exe /c start \"\" /D \"%s\" \"%s\" %s",workingDir,cmdName,commandArg));
		return (int)::WinExec(wxString::Format("cmd.exe /c start \"\" /D \"%s\" \"%s\" %s",workingDir,cmdName,commandArg),SW_HIDE) > 32;
		//wxString tmpName = GetFullCmdName(cmdName,workingDir,false);
		//if (tmpName.empty())
		//{
		//	::wxMessageBox(wxString::Format(wxT("无法运行 '%s'。请确定文件名是否正确后,再试一次。"),cmdName),cmdName,wxOK | wxICON_ERROR);
		//	return false;
		//}
		//return (int)::ShellExecute(NULL,(runas?_T("RunAs"):NULL), tmpName.c_str(), commandArg.c_str(), workingDir.c_str(), showCommand)>32;
	}

	LocationExec = false;//定位文件位置标志复位
	cmdName.Replace('/','\\');
	cmdName = GetFullCmdName(cmdName,workingDir,true);
#ifdef _ALMRUN_CONFIG_H_
	if (!g_config->Explorer.empty())
		return (int)::WinExec(wxString::Format("%s \"%s\"",g_config->Explorer,cmdName),SW_SHOW) > 32;
#endif//ifdef _ALMRUN_CONFIG_H_
	return (int)::ShellExecute(NULL,NULL,_T("explorer.exe"),_T("/n,/select,")+cmdName.c_str(),NULL, SW_SHOW) > 32;
	
	//return (int)::ShellExecute(NULL,NULL,g_config->Explorer.c_str(),wxString::Format(wxT("\"%s\""),cmdName),NULL, SW_SHOW) > 32;
}
Exemplo n.º 4
0
/// HandleTextualCommand() allows us a limitted version of script/batch
/// behavior, since we can get from a string command name to the actual
/// code to run.
bool CommandManager::HandleTextualCommand(wxString & Str, wxUint32 flags, wxUint32 mask)
{
   unsigned int i;

   // Linear search for now...
   for(i=0; i<mCommandList.GetCount(); i++) {
      if (!mCommandList[i]->multi)
      {
         if( Str.IsSameAs( mCommandList[i]->name ))
         {
            return HandleCommandEntry( mCommandList[i], flags, mask);
         }
      }
   }
   // Not one of the singleton commands.
   // We could/should try all the list-style commands.
   // instead we only try the effects.
   EffectArray *effects;
   AudacityProject * proj;
   proj = GetActiveProject();
   if( !proj )
      return false;

   int effectFlags = ALL_EFFECTS | CONFIGURED_EFFECT;
   effects = EffectManager::Get().GetEffects(effectFlags);
   for(i=0; i<effects->GetCount(); i++) {
      wxString effectName = (*effects)[i]->GetEffectName();
      if( Str.IsSameAs( effectName ))
      {
         return proj->OnEffect( effectFlags, (*effects)[i] ); 
      }
   }
   return false;
}
Exemplo n.º 5
0
void Associations::DoSetAssociation(const wxString& ext, const wxString& descr, const wxString& exe, int icoNum)
{
    wxString BaseKeyName(_T("HKEY_CURRENT_USER\\Software\\Classes\\"));
    if (platform::WindowsVersion() == platform::winver_Windows9598ME)
        BaseKeyName = _T("HKEY_CLASSES_ROOT\\");

    wxString node(_T(KEY_NAME) + ext);

    wxRegKey key; // defaults to HKCR
    key.SetName(BaseKeyName + _T(".") + ext);
    key.Create();
    key = _T(KEY_NAME) + ext;

    key.SetName(BaseKeyName + node);
    key.Create();
    key = descr;

    key.SetName(BaseKeyName + node + _T("\\DefaultIcon"));
    key.Create();
    key = exe + wxString::Format(_T(",%d"), icoNum);

    key.SetName(BaseKeyName + node + _T("\\shell\\open\\command"));
    key.Create();
    key = _T("\"") + exe + _T("\" \"%1\"");

    key.SetName(BaseKeyName + node + _T("\\shell\\open\\ddeexec"));
    key.Create();
    key = _T("[Open(\"%1\")]");

    key.SetName(BaseKeyName + node + _T("\\shell\\open\\ddeexec\\application"));
    key.Create();
    key = DDE_SERVICE;

    key.SetName(BaseKeyName + node + _T("\\shell\\open\\ddeexec\\ifexec"));
    key.Create();
    key = _T("[IfExec_Open(\"%1\")]");;

    key.SetName(BaseKeyName + node + _T("\\shell\\open\\ddeexec\\topic"));
    key.Create();
    key = DDE_TOPIC;

    if (ext.IsSameAs(FileFilters::EMBLOCKS_EXT) || ext.IsSameAs(FileFilters::WORKSPACE_EXT))
    {
        wxString batchbuildargs = Manager::Get()->GetConfigManager(_T("app"))->Read(_T("/batch_build_args"), appglobals::DefaultBatchBuildArgs);
        key.SetName(BaseKeyName + node + _T("\\shell\\Build\\command"));
        key.Create();
        key = _T("\"") + exe + _T("\" ") + batchbuildargs + _T(" --build \"%1\"");

        key.SetName(BaseKeyName + node + _T("\\shell\\Rebuild (clean)\\command"));
        key.Create();
        key = _T("\"") + exe + _T("\" ") + batchbuildargs + _T(" --rebuild \"%1\"");
    }
}
Exemplo n.º 6
0
int wxComboBox::FindString( const wxString &item, bool bCase ) const
{
    wxCHECK_MSG( m_widget != NULL, wxNOT_FOUND, wxT("invalid combobox") );

#ifdef __WXGTK24__
    if (!gtk_check_version(2,4,0))
    {
        GtkComboBox* combobox = GTK_COMBO_BOX( m_widget );
        GtkTreeModel* model = gtk_combo_box_get_model( combobox );
        GtkTreeIter iter;
        gtk_tree_model_get_iter_first( model, &iter );
        if (!gtk_list_store_iter_is_valid(GTK_LIST_STORE(model), &iter ))
            return -1;
        int count = 0;
        do
        {
            GValue value = { 0, };
            gtk_tree_model_get_value( model, &iter, 0, &value );
            wxString str = wxGTK_CONV_BACK( g_value_get_string( &value ) );
            g_value_unset( &value );

            if (item.IsSameAs( str, bCase ) )
                return count;

            count++;

        } while (gtk_tree_model_iter_next( model, &iter ));
    }
    else
#endif
    {
        GtkWidget *list = GTK_COMBO(m_widget)->list;

        GList *child = GTK_LIST(list)->children;
        int count = 0;
        while (child)
        {
            GtkBin *bin = GTK_BIN( child->data );
            GtkLabel *label = GTK_LABEL( bin->child );
            wxString str( wxGTK_CONV_BACK( gtk_label_get_text(label) ) );

            if (item.IsSameAs( str , bCase ) )
                return count;

            count++;
            child = child->next;
        }
    }

    return wxNOT_FOUND;
}
Exemplo n.º 7
0
wxString ConfigManager::Read(const wxString& name, const wxString& defaultVal)
{
    if (name.IsSameAs(CfgMgrConsts::app_path))
        return app_path;
    else if (name.IsSameAs(CfgMgrConsts::data_path))
        return data_path_global;

    wxString ret;

    if (Read(name, &ret))
        return ret;
    else
        return defaultVal;
}
Exemplo n.º 8
0
void MerryController::ShowWindow(void* window, const wxString& show) const
{
	int cmdShow = SW_SHOW;
	if (show.IsSameAs(wxT("hide"), false))
		cmdShow = SW_HIDE;
	else if (show.IsSameAs(wxT("min"), false))
		cmdShow = SW_SHOWMINIMIZED;
	else if (show.IsSameAs(wxT("max"), false))
		cmdShow = SW_SHOWMAXIMIZED;
	else if (show.IsSameAs(wxT("restore"), false))
		cmdShow = SW_RESTORE;

	::ShowWindow((HWND)window, cmdShow);
}
void Parameter::SetPercType(const wxString& type)
{
    if (type.IsSameAs("none"))
        SetPercType(Parameter::NONE);
    else if (type.IsSameAs("area"))
        SetPercType(Parameter::AREA);
    else if (type.IsSameAs("width"))
        SetPercType(Parameter::WIDTH);
    else if (type.IsSameAs("height"))
        SetPercType(Parameter::HEIGHT);
    else if (type.IsSameAs("colour_range"))
        SetPercType(Parameter::COLOUR_RANGE);
    else
        wxFAIL_MSG("Unkown percent type");
}
Exemplo n.º 10
0
static bool GetHtmlBoolValue(const wxString& value)
{
    if (value.IsSameAs(wxT("true"),false) || value == wxT("1"))
        return true;
    else
        return false;
}
Exemplo n.º 11
0
bool EDA_ITEM::Matches( const wxString& aText, wxFindReplaceData& aSearchData )
{
    wxString text = aText;
    wxString searchText = aSearchData.GetFindString();

    // Don't match if searching for replaceable item and the item doesn't support text replace.
    if( (aSearchData.GetFlags() & FR_SEARCH_REPLACE) && !IsReplaceable() )
        return false;

    if( aSearchData.GetFlags() & wxFR_WHOLEWORD )
        return aText.IsSameAs( searchText, aSearchData.GetFlags() & wxFR_MATCHCASE );

    if( aSearchData.GetFlags() & FR_MATCH_WILDCARD )
    {
        if( aSearchData.GetFlags() & wxFR_MATCHCASE )
            return text.Matches( searchText );

        return text.MakeUpper().Matches( searchText.MakeUpper() );
    }

    if( aSearchData.GetFlags() & wxFR_MATCHCASE )
        return aText.Find( searchText ) != wxNOT_FOUND;

    return text.MakeUpper().Find( searchText.MakeUpper() ) != wxNOT_FOUND;
}
Exemplo n.º 12
0
int wxComboBox::FindString( const wxString &item, bool bCase ) const
{
    wxCHECK_MSG( m_widget != NULL, wxNOT_FOUND, wxT("invalid combobox") );

    GtkWidget *list = GTK_COMBO(m_widget)->list;

    GList *child = GTK_LIST(list)->children;
    int count = 0;
#if defined(__INTEL_COMPILER) && 1 /* VDM auto patch */
#   pragma ivdep
#   pragma swp
#   pragma unroll
#   pragma prefetch
#   if 0
#       pragma simd noassert
#   endif
#endif /* VDM auto patch */
    while (child)
    {
        GtkBin *bin = GTK_BIN( child->data );
        GtkLabel *label = GTK_LABEL( bin->child );
        wxString str( label->label );
        if (item.IsSameAs( str , bCase ) )
            return count;

        count++;
        child = child->next;
    }

    return wxNOT_FOUND;
}
Exemplo n.º 13
0
int wxChoice::FindString( const wxString &string, bool bCase ) const
{
    wxCHECK_MSG( m_widget != NULL, wxNOT_FOUND, wxT("invalid choice") );

    // If you read this code once and you think you understand
    // it, then you are very wrong. Robert Roebling.

    GtkMenuShell *menu_shell = GTK_MENU_SHELL( gtk_option_menu_get_menu( GTK_OPTION_MENU(m_widget) ) );
    int count = 0;
    GList *child = menu_shell->children;
    while (child)
    {
        GtkBin *bin = GTK_BIN( child->data );
        GtkLabel *label = NULL;
        if (bin->child)
            label = GTK_LABEL(bin->child);
        if (!label)
            label = GTK_LABEL( BUTTON_CHILD(m_widget) );

        wxASSERT_MSG( label != NULL , wxT("wxChoice: invalid label") );

         wxString tmp( label->label );

         if (string.IsSameAs( tmp, bCase ))
            return count;

        child = child->next;
        count++;
    }

    return wxNOT_FOUND;
}
Exemplo n.º 14
0
int wxChoice::FindString( const wxString &item, bool bCase ) const
{
    wxCHECK_MSG( m_widget != NULL, wxNOT_FOUND, wxT("invalid control") );

    GtkComboBox* combobox = GTK_COMBO_BOX( m_widget );
    GtkTreeModel* model = gtk_combo_box_get_model( combobox );
    GtkTreeIter iter;
    gtk_tree_model_get_iter_first( model, &iter );
    if (!gtk_list_store_iter_is_valid(GTK_LIST_STORE(model), &iter ))
        return -1;
    int count = 0;
    do
    {
        GValue value = G_VALUE_INIT;
        gtk_tree_model_get_value( model, &iter, m_stringCellIndex, &value );
        wxString str = wxGTK_CONV_BACK( g_value_get_string( &value ) );
        g_value_unset( &value );

        if (item.IsSameAs( str, bCase ) )
            return count;

        count++;
    }
    while ( gtk_tree_model_iter_next(model, &iter) );

    return wxNOT_FOUND;
}
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;
}
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;
}
Exemplo n.º 17
0
wxString nsEnvVars::GetSetPathByName(const wxString& set_name, bool check_exists,
                                     bool return_default)
{
#if defined(TRACE_ENVVARS)
  Manager::Get()->GetLogManager()->DebugLog(F(_T("GetSetPathByName")));
#endif

  wxString set_path = _T("/sets/")+nsEnvVars::EnvVarsDefault; // fall back solution
  if (!return_default)
    set_path.Empty();

  ConfigManager *cfg = Manager::Get()->GetConfigManager(_T("envvars"));
  if (!cfg || set_path.IsEmpty())
    return set_path;

  if (!check_exists)
    return _T("/sets/")+set_name;

  // Read all envvar sets available
  wxArrayString sets     = cfg->EnumerateSubPaths(_T("/sets"));
  unsigned int  num_sets = sets.GetCount();
  for (unsigned int i=0; i<num_sets; ++i)
  {
    if (set_name.IsSameAs(sets[i]))
    {
      set_path = (_T("/sets/")+set_name);
      break; // Early exit of for-loop
    }
  }

  return set_path;
}// GetSetPathByName
Exemplo n.º 18
0
/**
 * HTMLノード内(<dd>~~~</dd>)に引数の要素があるか調べる
 * @param  const htmlNodePtr ptr	スレッドのHTML
 * @param  const wxString& target	     抽出対象のレス番号
 * @return true: あり, false: なし
 */
bool XrossBoardUtil::DDNodeHasTarget(const htmlNodePtr dd, const wxString& target)
{
     for (htmlNodePtr ptr = dd->children; ptr != NULL; ptr = ptr->next) 
     {
	  if (ptr->type == XML_ELEMENT_NODE && 
	      xmlStrcasecmp(ptr->name, (const xmlChar*) "a") == 0)
	  {
	       xmlAttr* attribute = ptr->properties;
	       while(attribute && attribute->name && attribute->children)
	       {
		    xmlChar* value = xmlNodeListGetString(ptr->doc, attribute->children, 1);
		    //do something with value
		    if (xmlStrcasecmp(value, (const xmlChar*) "_blank") == 0)
		    {
			 // >>xxx (= ptr->children->content) データは実体参照ではない ">>12"
			 const wxString anchor = wxString::FromUTF8(reinterpret_cast<const char*>(ptr->children->content));
			 const wxString number = anchor.SubString(2, anchor.Len() - 1);

			 if (number.IsSameAs(target))
			 {
			      return true;
			 }
		    }
					
		    xmlFree(value); 
		    attribute = attribute->next;
	       }
	  }
     }

     return false;
}
Exemplo n.º 19
0
void CGMSKClientThread::setRpt2(const wxString& rpt2)
{
    // An empty RPT2 callsign
    if (rpt2.IsSameAs(UNUSED))
        m_rpt2 = wxT("        ");
    else
        m_rpt2 = rpt2;
}
void CDummyRepeaterThread::setRpt2(const wxString& rpt2)
{
	// An empty RPT2 callsign
	if (rpt2.IsSameAs(UNUSED))
		m_rpt2 = wxT("        ");
	else
		m_rpt2 = rpt2;
}
void CDummyRepeaterThread::setRpt1(const wxString& rpt1)
{
	// An empty RPT1 callsign also implies an empty RPT2
	if (rpt1.IsSameAs(UNUSED)) {
		m_rpt1 = wxT("        ");
		m_rpt2 = wxT("        ");
	} else {
		m_rpt1 = rpt1;
	}
}
Exemplo n.º 22
0
/*

SpellVisualeffects.dbc
column 1 = id, int
column 2 = spell name, string
column 3 = model name, string
column 4 = number between 0 and 11, int
column 5 = number 0 or 1,  1 entry is 50?, int.. possibly boolean.

Column 3, ignore entries starting with "zzOLD__" ?
Column 4, wtf are .mdl files? they're from warcraft 3?

col 5 and 6? figure out what they're for.
Column5 is either Spell Type,  or Spell slot or something similar
*/
SpellEffectsDB::Record SpellEffectsDB::getByName(const wxString name)
{
	for(Iterator i=begin(); i!=end(); ++i)
	{
		if (name.IsSameAs(i->getString(EffectName), false) == true)
			return (*i);
	}
	//wxLogMessage(wxT("NotFound: %s:%s#%d"), __FILE__, __FUNCTION__, __LINE__);
	throw NotFound();
}
Exemplo n.º 23
0
const int MerryCommandManager::AddCommand(const wxString& commandName,const wxString& commandDesc,const wxString& commandLine,const wxString& commandWorkDir, int funcRef, const wxString& triggerKey,int flags)
{
	if (m_commands.size() >= 10000)
	{
		MerrySetLastError(wxT("\n超过10000个命令限制,目前限制命令数量不可以超过10000个,有特殊需求请联系我或到到网站留言 http://chenall.net"));
		return -2;
	}

	if (commandName.empty() && triggerKey.empty())
	{
		MerrySetLastError(wxT("\n热键(KEY)或名称(NAME),至少需要设置一个"));
		return -1;
	}
	for (size_t i=0; i<m_commands.size(); ++i)
	{
		const MerryCommand* command = m_commands[i];
		assert(command);
		if (!triggerKey.empty() && triggerKey.IsSameAs(command->GetTriggerKey(), false))
		{
			MerrySetLastError(wxString::Format(wxT("\n命令[%s]热键重复\n\n%s\n"), commandName,command->GetDetails()));
			return -1;
		}
		if (g_config && g_config->get(DuplicateCMD))
			continue;
		if (!commandName.empty() && commandName.IsSameAs(command->GetCommandName(), false))
		{
			if (!(flags & CMDS_FLAG_CMDS) || (command->GetFlags() & CMDS_FLAG_CMDS))
			{
				MerrySetLastError(wxString::Format(wxT("\n命令[%s]已经存在\n\n%s"),commandName,command->GetDetails()));
				return -1;
			}
		}
	}
	MerryCommand* command = new MerryCommand(m_commands.size() | (flags<<16), commandName,commandDesc,commandLine,commandWorkDir, funcRef, triggerKey);
	if (command->GetCommandID() == -1)
	{
		delete command;
		return -1;
	}
	m_commands.push_back(command);
	return command->GetCommandID();
}
Exemplo n.º 24
0
    bool MatchEtags(wxString snapshots_etag, wxString current_v_etag)
	{
		if(snapshots_etag.IsSameAs(current_v_etag))
			return true;
		auto iter = etagmapping.find(current_v_etag);
		if(iter != etagmapping.end())
		{
			if((*iter).second.IsSameAs(snapshots_etag))
				return true;
		}
		return false;
	};
Exemplo n.º 25
0
int wxComboBox::FindString(const wxString& s, bool bCase) const
{
    if (!bCase)
    {
        for (unsigned i = 0; i < GetCount(); i++)
        {
            if (s.IsSameAs(GetString(i), false))
                return i;
        }
        return wxNOT_FOUND;
    }

    return GetComboPeer()->FindString(s);
}
Exemplo n.º 26
0
// Races
CharRacesDB::Record CharRacesDB::getByName(wxString name)
{
	for(Iterator i=begin(); i!=end(); ++i) {
		wxString r;
		if (gameVersion == 30100)
			r = i->getString(NameV310);
		else
			r = i->getString(Name);
		if (name.IsSameAs(r, false) == true)
			return (*i);
	}
	//wxLogMessage(wxT("NotFound: %s:%s#%d"), __FILE__, __FUNCTION__, __LINE__);
	throw NotFound();
}
Exemplo n.º 27
0
wxString dlgSearchObject::getMapKeyByValue(wxString search_value)
{
	wxString key = wxEmptyString;
	LngMapping::iterator it;

	for (it = aMap.begin(); it != aMap.end(); ++it)
	{
		if (search_value.IsSameAs(it->second))
		{
			key = it->first;
			break;
		}
	}
	return key;
}
Exemplo n.º 28
0
int wxListBox::FindString( const wxString &item, bool bCase ) const
{
    wxCHECK_MSG( m_treeview != NULL, wxNOT_FOUND, wxT("invalid listbox") );

    //Sort of hackish - maybe there is a faster way
    unsigned int nCount = wxListBox::GetCount();

    for(unsigned int i = 0; i < nCount; ++i)
    {
        if( item.IsSameAs( wxListBox::GetString(i), bCase ) )
            return (int)i;
    }


    // it's not an error if the string is not found -> no wxCHECK
    return wxNOT_FOUND;
}
bool CRemoteProtocolHandler::readLink(wxString& callsign, RECONNECT& reconnect, wxString& reflector)
{
	if (m_type != RPHT_LINK)
		return false;

	callsign = wxString((char*)(m_inBuffer + 3U), wxConvLocal, LONG_CALLSIGN_LENGTH);

	wxInt32 temp;
	::memcpy(&temp, m_inBuffer + 3U + LONG_CALLSIGN_LENGTH, sizeof(wxInt32));
	reconnect = RECONNECT(wxINT32_SWAP_ON_BE(temp));

	reflector = wxString((char*)(m_inBuffer + 3U + LONG_CALLSIGN_LENGTH + sizeof(wxInt32)), wxConvLocal, LONG_CALLSIGN_LENGTH);

	if (reflector.IsSameAs(wxT("        ")))
		reflector.Clear();

	return true;
}
Exemplo n.º 30
0
int wxListBox::FindString( const wxString &item, bool bCase ) const
{
    wxCHECK_MSG( m_list != NULL, wxNOT_FOUND, wxT("invalid listbox") );

    GList *child = m_list->children;
    int count = 0;
    while (child)
    {
        if ( item.IsSameAs( GetRealLabel(child), bCase ) )
            return count;

        count++;
        child = child->next;
    }

    // it's not an error if the string is not found -> no wxCHECK

    return wxNOT_FOUND;
}