diff options
author | Ima Mechanique <ima.mechanique@secondlife.com> | 2014-01-30 13:01:19 +0000 |
---|---|---|
committer | Ima Mechanique <ima.mechanique@secondlife.com> | 2014-01-30 13:01:19 +0000 |
commit | 4bcb67c704098d30f0969cc4791018ce136e49e7 (patch) | |
tree | 4f0649d0db67352bdad757f3dea1773beb16db40 | |
parent | f14521e1d424425e2684467a829be38740332676 (diff) |
Making initialisation of mKeywords conditional on mSyntaxIdLSL having loaded an XML file.
-rwxr-xr-x | indra/newview/llpreviewscript.cpp | 53 |
1 files changed, 29 insertions, 24 deletions
diff --git a/indra/newview/llpreviewscript.cpp b/indra/newview/llpreviewscript.cpp index aedf687f0d..979074b453 100755 --- a/indra/newview/llpreviewscript.cpp +++ b/indra/newview/llpreviewscript.cpp @@ -395,7 +395,7 @@ BOOL LLScriptEdCore::postBuild() { mErrorList = getChild<LLScrollListCtrl>("lsl errors"); - mFunctions = getChild<LLComboBox>( "Insert..."); + mFunctions = getChild<LLComboBox>("Insert..."); childSetCommitCallback("Insert...", &LLScriptEdCore::onBtnInsertFunction, this); @@ -419,37 +419,42 @@ void LLScriptEdCore::onRegionChangeInitialiseKeywords() { mEditor->mKeywords.clearLoaded(); mSyntaxIdLSL.initialise(); - mEditor->mKeywords.initialise(mSyntaxIdLSL.getKeywordsXML()); - mEditor->loadKeywords(); - std::vector<std::string> primary_keywords; - std::vector<std::string> secondary_keywords; - LLKeywordToken *token; - LLKeywords::keyword_iterator_t token_it; - for (token_it = mEditor->keywordsBegin(); token_it != mEditor->keywordsEnd(); ++token_it) + if (mSyntaxIdLSL.isLoaded()) { - token = token_it->second; - if (token->getType() == LLKeywordToken::TT_FUNCTION) + mEditor->mKeywords.initialise(mSyntaxIdLSL.getKeywordsXML()); + + mEditor->loadKeywords(); + + std::vector<std::string> primary_keywords; + std::vector<std::string> secondary_keywords; + LLKeywordToken *token; + LLKeywords::keyword_iterator_t token_it; + for (token_it = mEditor->keywordsBegin(); token_it != mEditor->keywordsEnd(); ++token_it) { - primary_keywords.push_back( wstring_to_utf8str(token->getToken()) ); + token = token_it->second; + if (token->getType() == LLKeywordToken::TT_FUNCTION) + { + primary_keywords.push_back( wstring_to_utf8str(token->getToken()) ); + } + else + { + secondary_keywords.push_back( wstring_to_utf8str(token->getToken()) ); + } } - else + + for (std::vector<std::string>::const_iterator iter= primary_keywords.begin(); + iter!= primary_keywords.end(); ++iter) { - secondary_keywords.push_back( wstring_to_utf8str(token->getToken()) ); + mFunctions->add(*iter); } - } - for (std::vector<std::string>::const_iterator iter= primary_keywords.begin(); - iter!= primary_keywords.end(); ++iter) - { - mFunctions->add(*iter); - } - - for (std::vector<std::string>::const_iterator iter= secondary_keywords.begin(); - iter!= secondary_keywords.end(); ++iter) - { - mFunctions->add(*iter); + for (std::vector<std::string>::const_iterator iter= secondary_keywords.begin(); + iter!= secondary_keywords.end(); ++iter) + { + mFunctions->add(*iter); + } } } |