ItemRecord::ItemRecord(wxString line) : type(0) { id = wxAtoi(line.BeforeFirst(',')); line = line.AfterFirst(','); quality = wxAtoi(line.BeforeFirst(',')); line = line.AfterFirst(','); try { ItemDB::Record r = itemdb.getById(id); model = r.getInt(ItemDB::ItemDisplayInfo); itemclass = r.getInt(ItemDB::Itemclass); subclass = r.getInt(ItemDB::Subclass); type = r.getInt(ItemDB::InventorySlot); switch(r.getInt(ItemDB::Sheath)) { case SHEATHETYPE_MAINHAND: sheath = ATT_LEFT_BACK_SHEATH; break; case SHEATHETYPE_LARGEWEAPON: sheath = ATT_LEFT_BACK; break; case SHEATHETYPE_HIPWEAPON: sheath = ATT_LEFT_HIP_SHEATH; break; case SHEATHETYPE_SHIELD: sheath = ATT_MIDDLE_BACK_SHEATH; break; default: sheath = SHEATHETYPE_NONE; } discovery = false; name.Printf(wxT("%s [%d] [%d]"), line.c_str(), id, model); } catch (ItemDB::NotFound) {} }
/* compare strings that contains time periods in format 00:00:00 */ static int CompareTimeString(const wxString& first,const wxString& second) { long dtFirst,dtSecond; wxString hours,minutes,seconds; long lHours,lMinutes,lSeconds; //converting the first string to long value hours = first.BeforeFirst(':'); seconds = first.AfterLast(':'); minutes = first.AfterFirst(':').BeforeFirst(':'); hours.ToLong(&lHours); minutes.ToLong(&lMinutes); seconds.ToLong(&lSeconds); dtFirst = lSeconds + lMinutes * 60 + lHours * 3600; //converting the second string hours = second.BeforeFirst(':'); seconds = second.AfterLast(':'); minutes = second.AfterFirst(':').BeforeFirst(':'); hours.ToLong(&lHours); minutes.ToLong(&lMinutes); seconds.ToLong(&lSeconds); dtSecond = lSeconds + lMinutes * 60 + lHours * 3600; if(dtFirst < dtSecond) { return reverseCompareOrder ? 1 : -1 ; } if(dtSecond < dtFirst) { return reverseCompareOrder ? -1 : 1 ; } return 0; }
void SjLogGui::ExplodeMessage(const wxString& all___, unsigned long& severity, unsigned long& time, wxString& msg, wxString& scope) { wxString temp; // get and strip severity temp = all___.BeforeFirst(wxT('|')); temp.ToULong(&severity); msg = all___.AfterFirst(wxT('|')); // get and strip time temp = msg.BeforeFirst(wxT('|')); temp.ToULong(&time); msg = msg.AfterFirst(wxT('|')); // now "msg" is message and optional scope enclosured by "[]" scope.Empty(); int p = msg.Find(wxT('['), true/*from end*/); if( p!=-1 ) { scope = msg.Mid(p+1); if( scope.Len()>=1 && scope.Last()==wxT(']') ) { scope = scope.Left(scope.Len()-1); msg = msg.Left(p).Trim(); } } // some finalizing translations (some stuff is logged before the translation system is available) if( msg.StartsWith(wxT("Loading "), &temp) ) { msg.Printf(_("Loading %s"), temp.c_str()); } }
wxString readconfigdata(wxString &configstr) { configstr=configstr.AfterFirst(':'); wxString data=configstr.BeforeFirst('\n'); configstr=configstr.AfterFirst('\n'); return data; }
wxString conv_struct(wxString input)//input contains Structure structname:$\nvariable ...$\n { wxString output,structname,temporary; output.Empty(); structname = input.BeforeFirst('$');//contains Structure structname: structname = structname.AfterFirst(' '); structname = structname.BeforeFirst(':'); input = input.AfterFirst('$');//Contains list of data members - either variables or functions and then End Structure output << "struct " <<structname; output<<"\n{\n"; while(input.Contains(wxT("End")))//input has /nint ....$/n...$/npublic:$/n { temporary = input.BeforeFirst('$');//contains variable or function or public; if(temporary.Contains(wxT("End"))) break; else if(temporary.Contains(wxT("Variable"))) { temporary.Replace("\t ",""); output<<"\t "<< conv_variable(temporary)<<"\n"; } else if(temporary.Contains(wxT("Function"))) { temporary.Replace("\t ",""); output<<"\t " << conv_g_func(temporary)<<"\n"; } input = input.AfterFirst('$'); }//input contains End Struct $\n output<<"\n};"; return output; }
wxString conv_p_elseif(wxString input)//input = else if condition { wxString output,condition; input = input.AfterFirst(' '); condition = input.AfterFirst(' '); output.Empty(); output<<"else if( " << condition << " )\n"; //output = else if (condition)\n return output; }
//starting of funcs to conv globals... wxString conv_variable(wxString input) //converts input of form "Variable vame[23] as datatype*" to datatype* vname[23]; { wxString output,vname,datatype; input = input.AfterFirst(' '); //input contains "vame[23] as datatype*" vname = input.BeforeFirst(' '); input = input.AfterFirst(' ');//input contains "as datatype* datatype= input.AfterFirst(' '); output.Empty(); output<<datatype<<" "<<vname<<";"; return output; }
// Retrieves the Right Ascension, Declination, and Visual Magnitude of the star from the // line in the file void GLStars::GetStarValues(wxString buffer, Real *RightAscension, Real *Declination, Real *VisualMag){ wxString str; unsigned int i = 0; while (buffer[0] == ' '){ buffer = buffer.AfterFirst(' '); //i = 0; } for (i = 0; i < buffer.Length(); i++){ if (buffer[i] == '+') continue; else if (buffer[i] != '\n' && buffer[i] != ' '){ str.Append(buffer[i]); } else break; } str.ToDouble(RightAscension); str.Empty(); buffer = buffer.AfterFirst(' '); while (buffer[0] == ' '){ buffer = buffer.AfterFirst(' '); //i = 0; } for (i = 0; i < buffer.Length(); i++){ if (buffer[i] == '+') continue; else if (buffer[i] != '\n' && buffer[i] != ' '){ str.Append(buffer[i]); } else break; } str.ToDouble(Declination); str.Empty(); buffer = buffer.AfterFirst(' '); while (buffer[0] == ' '){ buffer = buffer.AfterFirst(' '); //i = 0; } for (i = 0; i < buffer.Length(); i++){ if (buffer[i] == '+') continue; else if (buffer[i] != '\n' && buffer[i] != ' '){ str.Append(buffer[i]); } else break; } str.ToDouble(VisualMag); str.Empty(); }
NPCRecord::NPCRecord(wxString line) : id(0), model(0), type(0) { if (line.Len() <= 3) return; id = wxAtoi(line.BeforeFirst(',')); line = line.AfterFirst(','); model = wxAtoi(line.BeforeFirst(',')); line = line.AfterFirst(','); type = wxAtoi(line.BeforeFirst(',')); line = line.AfterFirst(','); discovery = false; name.Printf(wxT("%s [%d] [%d]"), line.c_str(), id, model); }
wxString conv_class(wxString input)//input contains class classname:$/nprivate:$/nvariable ...$/n { wxString output,classname,temporary; output.Empty(); classname = input.BeforeFirst('$');//contains Class classname: classname = classname.AfterFirst(' '); classname = classname.BeforeFirst(':'); input = input.AfterFirst('$');//contains \n\tprivate:$\n..... output << "class " <<classname; temporary = input.BeforeFirst('$');//contains \n\tprivate: output<<"\n{"<<temporary<<"\n";//has private:\n input= input.AfterFirst('$'); //list of data members - either variables or functions and then $\n\tpublic:$\n while(input.Contains(wxT("public:")))//input has /nint ....$/n...$/npublic:$/n { temporary = input.BeforeFirst('$');//contains variable or function or public; if(temporary.Contains(wxT("public:"))) break; else if(temporary.Contains(wxT("Variable"))) { temporary.Replace("\t ",""); output<<"\t "<< conv_variable(temporary)<<"\n"; } else if(temporary.Contains(wxT("Function"))) { temporary.Replace("\t ",""); output<<"\t " << conv_g_func(temporary)<<"\n"; } input = input.AfterFirst('$'); }//input contains \n\tpublic:$\n ... \nEnd Class$\n temporary = input.BeforeFirst('$');//contains \n\tpublic: output<<temporary<<"\n";//output has public:\n input = input.AfterFirst('$');//input has list of datamembers and then has endclass$\n while(input.Contains(wxT("End")))//input has /nint ....$/n...$/npublic:$/n { temporary = input.BeforeFirst('$');//contains variable or function or public; if(temporary.Contains(wxT("End"))) break; else if(temporary.Contains(wxT("Variable"))) { temporary.Replace("\t ",""); output<<"\t "<< conv_variable(temporary)<<"\n"; } else if(temporary.Contains(wxT("Function"))) { temporary.Replace("\t ",""); output<<"\t " << conv_g_func(temporary)<<"\n"; } input = input.AfterFirst('$'); } output<<"\n};"; return output; }
void hoxChesscapePlayer::_HandleTableCmd( const wxString& cmdStr ) { const wxString tCmd = cmdStr.BeforeFirst(0x10); wxString subCmdStr = cmdStr.AfterFirst(0x10); if (!subCmdStr.empty() && subCmdStr[subCmdStr.size()-1] == 0x10) subCmdStr = subCmdStr.substr(0, subCmdStr.size()-1); wxLogDebug("%s: Processing tCmd = [%s]...", __FUNCTION__, tCmd.c_str()); if ( tCmd == "Settings" ) _HandleTableCmd_Settings( subCmdStr ); else if ( tCmd == "Invite" ) _HandleTableCmd_Invite( subCmdStr ); else { /* NOTE: The Chesscape server only support 1 table for now. */ hoxTable_SPtr pTable = _GetMyTable(); if ( ! pTable ) { wxLogDebug("%s: *WARN* This player [%s] not yet joined any table.", __FUNCTION__, this->GetId().c_str()); return; } if ( tCmd == "MvPts" ) _HandleTableCmd_PastMoves( pTable, subCmdStr ); else if ( tCmd == "Move" ) _HandleTableCmd_Move( pTable, subCmdStr ); else if ( tCmd == "GameOver" ) _HandleTableCmd_GameOver( pTable, subCmdStr ); else if ( tCmd == "OfferDraw" ) _HandleTableCmd_OfferDraw( pTable ); else if ( tCmd == "Clients" ) _HandleTableCmd_Clients( pTable, subCmdStr ); else if ( tCmd == "Unjoin" ) _HandleTableCmd_Unjoin( pTable, subCmdStr ); else { wxLogDebug("%s: *** Ignore this Table-command = [%s].", __FUNCTION__, tCmd.c_str()); } } }
//--------------------------------------------------------- wxTreeItemId CData_Source_PgSQL::Get_Server_Item(const wxString &Server, bool bCreate) { wxString Name = Server.AfterFirst('[').BeforeFirst(']'); wxTreeItemIdValue Cookie; wxTreeItemId Item = GetFirstChild(GetRootItem(), Cookie); while( Item.IsOk() ) { if( !Name.Cmp(GetItemText(Item)) ) { return( Item ); } Item = GetNextChild(Item, Cookie); } if( bCreate ) { Item = AppendItem(GetRootItem(), Name, IMG_SERVER, IMG_SERVER, new CData_Source_PgSQL_Data(TYPE_SERVER, &Name, &Name)); SortChildren(GetRootItem()); Expand (GetRootItem()); } return( Item ); }
void SjMainFrame::SetDisplayMsg(const wxString& text, long holdMs) { m_display.m_msg1 = text.BeforeFirst('\n'); m_display.m_msg2 = text.AfterFirst('\n'); m_display.m_msgCancelAtTimestamp = SjTools::GetMsTicks()+holdMs; UpdateDisplay(); }
wxString conv_g_func(wxString input)//input = Function func_name parameters: int var1,char * var2,int var3 returns char* { wxString output,fname,rtype,params; input = input.AfterFirst(' '); //input contains "func_name parameters: int var1,char * var2,int var3 returns char*" fname = input.BeforeFirst(' '); input = input.AfterFirst(' ');//input contains "parameters: int var1,char * var2,int var3 returns char*" input = input.AfterFirst(' ');//input contains "int var1,char * var2,int var3 returns char*" input.Replace("returns","%returns");//input contains "int var1,char * var2,int var3 %returns char*" params = input.BeforeFirst('%'); if(params.Contains(wxT("none"))) params.Empty(); input = input.AfterFirst('%'); rtype = input.AfterFirst(' '); output.Empty(); output<< rtype <<" " << fname << "(" << params <<");"; //output = char* func_name(int var1,char * var2,int var3); return output; }
wxString conv_p_forloop(wxString input)//input = for loop from i=0 until i<5 update i=i+2 { wxString output,initial,condition,reinitial; input.Replace("for loop from","for"); initial = input.AfterFirst(' '); input = initial;//i=0 until i<5 update i=i+2 initial = initial.BeforeFirst(' '); input = input.AfterFirst(' ');//until i<5 update i=i+2 input = input.AfterFirst(' ');//i<5 update i=i+2 condition = input.BeforeFirst(' '); input = input.AfterFirst(' ');//update i=i+2 reinitial = input.AfterFirst(' '); output.Empty(); output<<"for( "<<initial<<" ; "<< condition << " ; "<< reinitial <<" )\n"; //output = for( int i=0 ; i<5 ; i=i+2 )\n return output; }
void hoxChesscapePlayer::_HandleTableCmd_Invite( const wxString& cmdStr ) { wxLogDebug("%s: ENTER. cmdStr = [%s].", __FUNCTION__, cmdStr.c_str()); const wxString sInvitorId = cmdStr.BeforeFirst(0x10); const wxString sTableId = cmdStr.AfterFirst(0x10); /* Look up the Invitor's score. */ int nInvitorScore = m_site->GetScoreOfOnlinePlayer( sInvitorId ); if ( nInvitorScore == hoxSCORE_UNKNOWN ) { wxLogDebug("%s: *WARN* Player [%s] not found.", __FUNCTION__, sInvitorId.c_str()); nInvitorScore = 0; } const wxString sMessage = wxString::Format("*INVITE from [%s (%d)] to Table [%s]", sInvitorId.c_str(), nInvitorScore, sTableId.c_str()); hoxTable_SPtr pTable = _GetMyTable(); if ( pTable ) { pTable->PostBoardMessage( sMessage ); } else { ::wxMessageBox( sMessage, _("Invitation from Player"), wxOK | wxICON_INFORMATION ); } }
bool User::ExecuteSayCommand( const wxString& cmd ) const { if ( cmd.BeforeFirst(' ').Lower() == _T("/me") ) { GetServer().DoActionPrivate( m_nick, cmd.AfterFirst(' ') ); return true; } else return false; }
void wxSheetCellFloatRendererRefData::SetParameters(const wxString& params) { if ( params.IsEmpty() ) { // reset to defaults SetWidth(-1); SetPrecision(-1); } else { wxString tmp( params.BeforeFirst(_T(',')) ); if ( !tmp.IsEmpty() ) { long width; if ( tmp.ToLong(&width) ) SetWidth((int)width); else wxLogDebug(_T("Invalid wxSheetCellFloatRenderer width parameter string '%s ignored"), params.c_str()); } tmp = params.AfterFirst(_T(',')); if ( !tmp.IsEmpty() ) { long precision; if ( tmp.ToLong(&precision) ) SetPrecision((int)precision); else wxLogDebug(_T("Invalid wxSheetCellFloatRenderer precision parameter string '%s ignored"), params.c_str()); } } }
/* checks if the value is a valid time interval, format HH:MM-HH:MM */ bool CDlgAdvPreferences::IsValidTimeIntervalValue(const wxString& value) { for(unsigned int i=0; i < value.Length();i++) { if(!IsValidTimeIntervalChar(value[i])) { return false; } } //all chars are valid, now what is with the value as a whole ? //check for - if(value.Find('-')<0) { return false; } //split up into start and stop wxString start = value.BeforeFirst('-'); wxString stop = value.AfterFirst('-'); //validate start and stop parts if(!IsValidTimeValue(start) || !IsValidTimeValue(stop)) { return false; } //ensure that start is lower than stop wxDateTime dtStart,dtStop; dtStart.ParseFormat(start,wxT("%H:%M")); dtStop.ParseFormat(stop,wxT("%H:%M")); // /*if(dtStart>=dtStop) { return false; }*/ return true; }
void BattleMapTab::Update( const wxString& Tag ) { if ( !m_battle ) return; long type; Tag.BeforeFirst( '_' ).ToLong( &type ); wxString key = Tag.AfterFirst( '_' ); wxString value = m_battle->CustomBattleOptions().getSingleValue( key, ( OptionsWrapper::GameOption )type ); long longval; value.ToLong( &longval ); if ( type == OptionsWrapper::EngineOption ) { if ( key == _T( "startpostype" ) ) { m_start_radios->SetSelection( longval ); m_minimap->UpdateMinimap(); } } else if ( type == OptionsWrapper::PrivateOptions ) { if ( key == _T( "mapname" ) ) { Update(); } } }
/** * FUNCTION: commandLineCleanOption * INPUTS: * option - input string needs to be reformatted * schemaObject - Is this an object related to schema? * PURPOSE: * - Fixup a (double-quoted) string for use on the command line */ wxString commandLineCleanOption(const wxString &option, bool schemaObject) { wxString tmp = option; if (schemaObject) { // Replace double-quote with slash & double-quote tmp.Replace(wxT("\""), wxT("\\\"")); } else { // If required, clean the string to know the real object name if (option.StartsWith(wxT("\"")) && option.EndsWith(wxT("\""))) tmp = option.AfterFirst((wxChar)'"').BeforeLast((wxChar)'"'); // Replace single splash to double-splash tmp.Replace(wxT("\\"), wxT("\\\\")); // Replace double-quote with slash & double-quote tmp.Replace(wxT("\""), wxT("\\\"")); // Replace double (slash & double-quote) combination to single (slash & double-quote) combination tmp.Replace(wxT("\\\"\\\""), wxT("\\\"")); // Add the double quotes tmp = wxT("\"") + tmp + wxT("\""); } return tmp; }
void ParseString(wxString& s, wxArrayString& sl) { int f, x; wxString stemp; bool found_string = true; sl.Clear(); x = s.Find('"'); found_string = (x > 0); if (found_string) stemp = s.Left(x); else stemp = s; f = stemp.Len(); x = stemp.First(' '); while (f > 0) { sl.Add(stemp.Left(x)); stemp = stemp.AfterFirst(' '); f = stemp.Len(); x = stemp.Find(' '); if ((x < 0) && (f > 0)) x = f; } if (found_string) { stemp = s.AfterFirst('"'); stemp = stemp.BeforeLast('"'); sl.Add(stemp); } }
void wxGridCellFloatEditor::SetParameters(const wxString& params) { if ( !params ) { // reset to default m_width = m_precision = -1; } else { long tmp; if ( params.BeforeFirst(wxT(',')).ToLong(&tmp) ) { m_width = (int)tmp; if ( params.AfterFirst(wxT(',')).ToLong(&tmp) ) { m_precision = (int)tmp; // skip the error message below return; } } wxLogDebug(wxT("Invalid wxGridCellFloatEditor parameter string '%s' ignored"), params.c_str()); } }
void NewBuildTab::DoUpdateCurrentCompiler(const wxString& line) { wxString projectName, configuration; if ( line.Contains ( wxGetTranslation(BUILD_PROJECT_PREFIX) ) ) { // now building the next project wxString prj = line.AfterFirst ( wxT ( '[' ) ).BeforeFirst ( wxT ( ']' ) ); projectName = prj.BeforeFirst ( wxT ( '-' ) ).Trim ( false ).Trim(); configuration = prj.AfterFirst ( wxT ( '-' ) ).Trim ( false ).Trim(); m_cmp.Reset ( NULL ); // need to know the compiler in use for this project to extract // file/line and error/warning status from the text BuildConfigPtr bldConf = WorkspaceST::Get()->GetProjBuildConf(projectName, configuration); if ( bldConf ) { m_cmp = BuildSettingsConfigST::Get()->GetCompiler ( bldConf->GetCompilerType() ); } else { // probably custom build with project names incorret // assign the default compiler for this purpose if ( BuildSettingsConfigST::Get()->IsCompilerExist(wxT("gnu g++")) ) { m_cmp = BuildSettingsConfigST::Get()->GetCompiler( wxT("gnu g++") ); } } } if( !m_cmp ) { if ( BuildSettingsConfigST::Get()->IsCompilerExist(wxT("gnu g++")) ) { m_cmp = BuildSettingsConfigST::Get()->GetCompiler( wxT("gnu g++") ); } } }
bool hoxChesscapePlayer::_ParseIncomingCommand( const wxMemoryBuffer& data, wxString& command, wxString& paramsStr ) const { /* TODO: Force to convert the buffer to a string. */ const wxString contentStr = wxString::FromUTF8( (const char*) data.GetData(), data.GetDataLen() ); if ( data.GetDataLen() > 0 && contentStr.empty() ) // failed? { wxLogDebug("%s: *WARN* Fail to convert [%d] data to string.", __FUNCTION__, data.GetDataLen()); return false; } /* CHECK: The first character must be 0x10 */ if ( contentStr.empty() || contentStr[0] != 0x10 ) { wxLogDebug("%s: *WARN* Invalid command = [%s].", __FUNCTION__, contentStr.c_str()); return false; } /* Chop off the 1st character */ const wxString actualContent = contentStr.Mid(1); /* Extract the command and its parameters-string */ command = actualContent.BeforeFirst( '=' ); paramsStr = actualContent.AfterFirst('='); return true; // success }
void FindSequenceDialog::getFromTo ( wxString s , long &from , long &to , int idx ) { from = to = -1 ; wxString type = s.BeforeFirst ( ':' ) ; wxString data = s.AfterFirst ( ':' ) ; if ( type == txt("sequence") ) { data.BeforeFirst('-').ToLong ( &from ) ; data.AfterFirst('-').ToLong ( &to ) ; } else if ( type == txt("amino_acid") ) { data = data.AfterLast ( '(' ) ; data.BeforeFirst('-').ToLong ( &from ) ; data.AfterFirst('-').ToLong ( &to ) ; } else if ( type == txt("t_vec_item") ) { from = c->vec->items[vi[idx]].from ; to = c->vec->items[vi[idx]].to ; } else if ( type == txt("m_restriction") ) { int a = vi[idx] ; from = c->vec->rc[a].getPos() - c->vec->rc[a].e->getCut() + 1 ; to = c->vec->rc[a].getPos() - c->vec->rc[a].e->getCut() + c->vec->rc[a].e->getSequence().length() + 1 ; } }
void ReconcileProjectFiletypesDlg::SetRegex(const wxString& regex) { int n = m_listCtrlRegexes->GetItemCount(); AppendListCtrlRow(m_listCtrlRegexes); SetColumnText(m_listCtrlRegexes, n, 0, regex.AfterFirst('|')); SetColumnText(m_listCtrlRegexes, n, 1, regex.BeforeFirst('|')); }
void StringTestCase::BeforeAndAfter() { // Construct a string with 2 equal signs in it by concatenating its three // parts: before the first "=", in between the two "="s and after the last // one. This allows to avoid duplicating the string contents (which has to // be different for Unicode and ANSI builds) in the tests below. #if wxUSE_UNICODE #define FIRST_PART L"letter" #define MIDDLE_PART L"\xe9;\xe7a" #define LAST_PART L"l\xe0" #else // !wxUSE_UNICODE #define FIRST_PART "letter" #define MIDDLE_PART "e;ca" #define LAST_PART "la" #endif // wxUSE_UNICODE/!wxUSE_UNICODE const wxString s(FIRST_PART wxT("=") MIDDLE_PART wxT("=") LAST_PART); wxString r; CPPUNIT_ASSERT_EQUAL( FIRST_PART, s.BeforeFirst('=', &r) ); CPPUNIT_ASSERT_EQUAL( MIDDLE_PART wxT("=") LAST_PART, r ); CPPUNIT_ASSERT_EQUAL( s, s.BeforeFirst('!', &r) ); CPPUNIT_ASSERT_EQUAL( "", r ); CPPUNIT_ASSERT_EQUAL( FIRST_PART wxT("=") MIDDLE_PART, s.BeforeLast('=', &r) ); CPPUNIT_ASSERT_EQUAL( LAST_PART, r ); CPPUNIT_ASSERT_EQUAL( "", s.BeforeLast('!', &r) ); CPPUNIT_ASSERT_EQUAL( s, r ); CPPUNIT_ASSERT_EQUAL( MIDDLE_PART wxT("=") LAST_PART, s.AfterFirst('=') ); CPPUNIT_ASSERT_EQUAL( "", s.AfterFirst('!') ); CPPUNIT_ASSERT_EQUAL( LAST_PART, s.AfterLast('=') ); CPPUNIT_ASSERT_EQUAL( s, s.AfterLast('!') ); #undef LAST_PART #undef MIDDLE_PART #undef FIRST_PART }
wxString CommandManager::GetKey(wxString label) { wxString key = label.AfterFirst(wxT('\t')).BeforeFirst(wxT('\t')); if (key.IsEmpty()) { return key; } return KeyStringNormalize(key); }
wxString UserVariableManager::Replace(const wxString& variable) { wxString package = variable.AfterLast(wxT('#')).BeforeFirst(wxT('.')).MakeLower(); wxString member = variable.AfterFirst(wxT('.')).MakeLower(); wxString path(cSets + m_ActiveSet + _T('/') + package + _T('/')); wxString base = m_CfgMan->Read(path + cBase); if (base.IsEmpty()) { if (Manager::Get()->GetProjectManager()->IsLoading()) { // a project/workspace is being loaded. // no need to bug the user now about global vars. // just preempt it; ProjectManager will call Arrogate() when it's done. Preempt(variable); return variable; } else { wxString msg; msg.Printf(_("In the currently active set, Code::Blocks does not know\n" "the global compiler variable \"%s\".\n\n" "Please define it."), package.wx_str()); InfoWindow::Display(_("Global Compiler Variables"), msg , 8000, 1000); UsrGlblMgrEditDialog d; d.AddVar(package); PlaceWindow(&d); d.ShowModal(); } } if (member.IsEmpty() || member.IsSameAs(cBase)) return base; if (member.IsSameAs(cInclude) || member.IsSameAs(cLib) || member.IsSameAs(cObj) || member.IsSameAs(cBin)) { wxString ret = m_CfgMan->Read(path + member); if (ret.IsEmpty()) ret = base + _T('/') + member; return ret; } const wxString wtf(wxT("#$%&???WTF???&%$#")); wxString ret = m_CfgMan->Read(path + member, wtf); if ( ret.IsSameAs(wtf) ) { wxString msg; msg.Printf(_("In the currently active set, Code::Blocks does not know\n" "the member \"%s\" of the global compiler variable \"%s\".\n\n" "Please define it."), member.wx_str(), package.wx_str()); InfoWindow::Display(_("Global Compiler Variables"), msg , 8000, 1000); } return ret; }