diff options
Diffstat (limited to 'indra/newview/llpreviewscript.cpp')
-rwxr-xr-x | indra/newview/llpreviewscript.cpp | 26 |
1 files changed, 15 insertions, 11 deletions
diff --git a/indra/newview/llpreviewscript.cpp b/indra/newview/llpreviewscript.cpp index 5f23249c8d..c662343238 100755 --- a/indra/newview/llpreviewscript.cpp +++ b/indra/newview/llpreviewscript.cpp @@ -34,6 +34,7 @@ #include "llcheckboxctrl.h" #include "llcombobox.h" #include "lldir.h" +#include "llenvmanager.h" #include "llexternaleditor.h" #include "llfilepicker.h" #include "llfloaterreg.h" @@ -406,18 +407,22 @@ BOOL LLScriptEdCore::postBuild() initMenu(); -// Make this work ;-) + // Intialise keyword highlighting for the current simulator's version of LSL + onRegionChangeInitialiseKeywords(); + // Set up a callback for region changes, so that highlighting is updated to the new region's version of LSL + LLEnvManagerNew::getInstance()->setRegionChangeCallback(boost::bind(&LLScriptEdCore::onRegionChangeInitialiseKeywords, this)); + + return TRUE; +} + +void LLScriptEdCore::onRegionChangeInitialiseKeywords() +{ + mEditor->mKeywords.clearLoaded(); mSyntaxIdLSL.initialise(); - // ... - mEditor->mKeywords.initialise(LL_PATH_APP_SETTINGS, "keywords_lsl_default.xml"); -// mEditor->mKeywords.initialise(mSyntaxIdLSL.getFullFileSpec()); + 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); + mEditor->loadKeywords(); std::vector<std::string> primary_keywords; std::vector<std::string> secondary_keywords; @@ -439,6 +444,7 @@ BOOL LLScriptEdCore::postBuild() // Case-insensitive dictionary sort for primary keywords. We don't sort the secondary // keywords. They're intelligently grouped in keywords.ini. + // As we don't use keywords.ini, this is no longer true. Do we need to sort now? std::stable_sort( primary_keywords.begin(), primary_keywords.end(), LLSECKeywordCompare() ); for (std::vector<std::string>::const_iterator iter= primary_keywords.begin(); @@ -452,8 +458,6 @@ BOOL LLScriptEdCore::postBuild() { mFunctions->add(*iter); } - - return TRUE; } void LLScriptEdCore::initMenu() |