summaryrefslogtreecommitdiff
path: root/indra/newview
diff options
context:
space:
mode:
authorIma Mechanique <ima.mechanique@secondlife.com>2013-11-10 21:57:29 +0000
committerIma Mechanique <ima.mechanique@secondlife.com>2013-11-10 21:57:29 +0000
commit488964157cb02b44ac9c72bb6c57e47c2b21ee53 (patch)
tree4b1022c0f89a41a7767853ead47c33a76d69d840 /indra/newview
parent5e27952ee4698006c86ebdca60c4eab305ddebac (diff)
Moving keywords code into its own method.
Diffstat (limited to 'indra/newview')
-rwxr-xr-xindra/newview/llpreviewscript.cpp87
-rwxr-xr-xindra/newview/llpreviewscript.h1
2 files changed, 47 insertions, 41 deletions
diff --git a/indra/newview/llpreviewscript.cpp b/indra/newview/llpreviewscript.cpp
index b464845256..0cf8dbe9c5 100755
--- a/indra/newview/llpreviewscript.cpp
+++ b/indra/newview/llpreviewscript.cpp
@@ -406,53 +406,58 @@ BOOL LLScriptEdCore::postBuild()
initMenu();
-// Make this work ;-)
- mSyntaxIdLSL.initialise();
- // ...
- mEditor->mKeywords.initialise(mSyntaxIdLSL.getKeywordsXML());
-
- // FIX: Refactor LLTextEditor::loadKeywords so these can be removed.
- std::vector<std::string> funcs;
- std::vector<std::string> tooltips;
-
- LLColor3 color(0.5f, 0.0f, 0.15f);
- mEditor->loadKeywords(gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS,"keywords.ini"), funcs, tooltips, color);
-
- 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)
- {
- token = token_it->second;
- // FIX: change this to use the new Token Type enum entries.
- if (token->getColor() == color) // Wow, what a disgusting hack.
- {
- primary_keywords.push_back( wstring_to_utf8str(token->getToken()) );
- }
- else
+ return initKeywords();
+}
+
+bool LLScriptEdCore::initKeywords()
+{
+ // Make this work ;-)
+ mSyntaxIdLSL.initialise();
+ // ...
+ mEditor->mKeywords.initialise(mSyntaxIdLSL.getKeywordsXML());
+
+ // FIX: Refactor LLTextEditor::loadKeywords so these can be removed.
+ //std::vector<std::string> funcs;
+ //std::vector<std::string> tooltips;
+
+ LLColor3 color(0.5f, 0.0f, 0.15f);
+ 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)
{
- secondary_keywords.push_back( wstring_to_utf8str(token->getToken()) );
+ token = token_it->second;
+ // FIX: change this to use the new Token Type enum entries.
+ if (token->getColor() == color) // Wow, what a disgusting hack.
+ {
+ primary_keywords.push_back( wstring_to_utf8str(token->getToken()) );
+ }
+ else
+ {
+ secondary_keywords.push_back( wstring_to_utf8str(token->getToken()) );
+ }
}
- }
- // Case-insensitive dictionary sort for primary keywords. We don't sort the secondary
- // keywords. They're intelligently grouped in keywords.ini.
- std::stable_sort( primary_keywords.begin(), primary_keywords.end(), LLSECKeywordCompare() );
+ // Case-insensitive dictionary sort for primary keywords. We don't sort the secondary
+ // keywords. They're intelligently grouped in keywords.ini.
+ std::stable_sort( primary_keywords.begin(), primary_keywords.end(), LLSECKeywordCompare() );
- 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= 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);
+ }
- return TRUE;
+ return TRUE;
}
void LLScriptEdCore::initMenu()
diff --git a/indra/newview/llpreviewscript.h b/indra/newview/llpreviewscript.h
index 73ccaab0b8..bc0256703e 100755
--- a/indra/newview/llpreviewscript.h
+++ b/indra/newview/llpreviewscript.h
@@ -78,6 +78,7 @@ public:
~LLScriptEdCore();
void initMenu();
+ bool initKeywords();
virtual void draw();
/*virtual*/ BOOL postBuild();