summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xindra/newview/llpreviewscript.cpp35
-rwxr-xr-xindra/newview/llpreviewscript.h1
2 files changed, 25 insertions, 11 deletions
diff --git a/indra/newview/llpreviewscript.cpp b/indra/newview/llpreviewscript.cpp
index 904b56b436..0ca4718250 100755
--- a/indra/newview/llpreviewscript.cpp
+++ b/indra/newview/llpreviewscript.cpp
@@ -407,27 +407,45 @@ BOOL LLScriptEdCore::postBuild()
initMenu();
- // Intialise keyword highlighting for the current simulator's version of LSL
+ mSyntaxIdLSL.addFileFetchedCallback(boost::bind(&LLScriptEdCore::onFileFetchedInitialiseKeywords, this));
+
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));
+ //gAgent.addRegionChangedCallback(boost::bind(&LLScriptEdCore::onRegionChangeInitialiseKeywords, this));
return TRUE;
}
void LLScriptEdCore::onRegionChangeInitialiseKeywords()
{
+ // 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;
- // Nasty Hack to get started, needs to replaced with a callback or similar.
- if (mSyntaxIdLSL.fetching())
+ if (mSyntaxIdLSL.isDifferentVersion())
+ {
+ if (mSyntaxIdLSL.isLoaded())
+ {
+ onFileFetchedInitialiseKeywords();
+ }
+ else
+ {
+ LL_INFOS("SyntaxLSL")
+ << "Hashes are the different, waiting for the syntax file to be retrieved." << LL_ENDL;
+ }
+ }
+ else
{
- LL_WARNS("SyntaxLSL") << "No Response in Time, still fetching!" << LL_ENDL;
+ LL_INFOS("SyntaxLSL")
+ << "Hashes are the same, no need to update highlighter." << LL_ENDL;
}
+}
- if (mSyntaxIdLSL.isDifferentVersion())
+void LLScriptEdCore::onFileFetchedInitialiseKeywords()
+{
+ if (mSyntaxIdLSL.isLoaded())
{
LL_INFOS("SyntaxLSL")
<< "Hashes are different, updating highlighter." << LL_ENDL;
@@ -472,11 +490,6 @@ void LLScriptEdCore::onRegionChangeInitialiseKeywords()
}
}
}
- else
- {
- LL_INFOS("SyntaxLSL")
- << "Hashes are the same, no need to update highlighter." << LL_ENDL;
- }
}
void LLScriptEdCore::initMenu()
diff --git a/indra/newview/llpreviewscript.h b/indra/newview/llpreviewscript.h
index 2dd5a1b6a7..67a4ca52fa 100755
--- a/indra/newview/llpreviewscript.h
+++ b/indra/newview/llpreviewscript.h
@@ -79,6 +79,7 @@ public:
void initMenu();
void onRegionChangeInitialiseKeywords();
+ void onFileFetchedInitialiseKeywords();
virtual void draw();
/*virtual*/ BOOL postBuild();