summaryrefslogtreecommitdiff
path: root/indra/newview/llpreviewscript.cpp
diff options
context:
space:
mode:
authorIma Mechanique <ima.mechanique@secondlife.com>2014-03-09 04:55:46 +0000
committerIma Mechanique <ima.mechanique@secondlife.com>2014-03-09 04:55:46 +0000
commit06bdcef531c79db7f6901e2c5f5f63b2f75ad4e5 (patch)
tree4e8915422dc04bab13f3f35ce784513b6874fdb7 /indra/newview/llpreviewscript.cpp
parenta2c084849f6c977c4c1c3151e0762c0137d34d0d (diff)
storm-1831 Fixing identificaton of label for highlighting.
Diffstat (limited to 'indra/newview/llpreviewscript.cpp')
-rwxr-xr-xindra/newview/llpreviewscript.cpp72
1 files changed, 45 insertions, 27 deletions
diff --git a/indra/newview/llpreviewscript.cpp b/indra/newview/llpreviewscript.cpp
index 0ca4718250..4c6f4fd3ba 100755
--- a/indra/newview/llpreviewscript.cpp
+++ b/indra/newview/llpreviewscript.cpp
@@ -407,52 +407,70 @@ BOOL LLScriptEdCore::postBuild()
initMenu();
- mSyntaxIdLSL.addFileFetchedCallback(boost::bind(&LLScriptEdCore::onFileFetchedInitialiseKeywords, this));
+ mSyntaxIdLSL.addFileFetchedCallback(boost::bind(&LLScriptEdCore::processKeywords, this));
+
+ // Intialise keyword highlighting for the current simulator's version of LSL
+ mSyntaxIdLSL.initialise();
+
+ if (mSyntaxIdLSL.isDifferentVersion())
+ {
+ processLoaded();
+ }
+ else
+ {
+ LL_INFOS("SyntaxLSL")
+ << "Hashes are the same, no need to update highlighter." << LL_ENDL;
+ }
- onRegionChangeInitialiseKeywords();
- // Set up a callback for region changes, so that highlighting is updated to the new region's version of LSL
- //gAgent.addRegionChangedCallback(boost::bind(&LLScriptEdCore::onRegionChangeInitialiseKeywords, this));
+ // Set up a callback for region changes
+ mRegionChangedCallback = gAgent.addRegionChangedCallback(boost::bind(&LLScriptEdCore::updateKeywords, this));
return TRUE;
}
-void LLScriptEdCore::onRegionChangeInitialiseKeywords()
+void LLScriptEdCore::updateKeywords()
{
- // Intialise keyword highlighting for the current simulator's version of LSL
- LL_DEBUGS("SyntaxLSL") << "Pre Initialise!" << LL_ENDL;
- mSyntaxIdLSL.initialise();
- LL_DEBUGS("SyntaxLSL") << "Post Initialise!" << LL_ENDL;
+ if (mLive)
+ {
+ clearHighlights();
+ gAgent.removeRegionChangedCallback(mRegionChangedCallback);
+ }
+ else
+ {
+ processLoaded();
+ }
+}
- if (mSyntaxIdLSL.isDifferentVersion())
+void LLScriptEdCore::processLoaded()
+{
+ mSyntaxIdLSL.initialise();
+ if (mSyntaxIdLSL.isLoaded())
{
- if (mSyntaxIdLSL.isLoaded())
- {
- onFileFetchedInitialiseKeywords();
- }
- else
- {
- LL_INFOS("SyntaxLSL")
- << "Hashes are the different, waiting for the syntax file to be retrieved." << LL_ENDL;
- }
+ processKeywords();
}
else
{
LL_INFOS("SyntaxLSL")
- << "Hashes are the same, no need to update highlighter." << LL_ENDL;
+ << "Hashes are different, waiting for the syntax file to be retrieved." << LL_ENDL;
}
}
-void LLScriptEdCore::onFileFetchedInitialiseKeywords()
+void LLScriptEdCore::clearHighlights()
+{
+ mEditor->mKeywords.clearLoaded();
+ mEditor->clearSegments();
+ mEditor->mKeywords.clear();
+}
+
+void LLScriptEdCore::processKeywords()
{
if (mSyntaxIdLSL.isLoaded())
{
LL_INFOS("SyntaxLSL")
<< "Hashes are different, updating highlighter." << LL_ENDL;
- mEditor->mKeywords.clearLoaded();
- mEditor->clearSegments();
- mEditor->mKeywords.clear();
+ clearHighlights();
if (mSyntaxIdLSL.isLoaded())
{
@@ -1227,8 +1245,8 @@ bool LLScriptEdCore::enableLoadFromFileMenu(void* userdata)
/// LLScriptEdContainer
/// ---------------------------------------------------------------------------
-LLScriptEdContainer::LLScriptEdContainer(const LLSD& key)
-: LLPreview(key)
+LLScriptEdContainer::LLScriptEdContainer(const LLSD& key) :
+ LLPreview(key)
, mScriptEd(NULL)
{
}
@@ -1750,7 +1768,7 @@ void* LLLiveLSLEditor::createScriptEdPanel(void* userdata)
&LLLiveLSLEditor::onSearchReplace,
self,
0);
-
+ self->mScriptEd->mLive = true;
return self->mScriptEd;
}