storm-1831 Changes in postBuild to use onFileFetchedCallback

meow-7.2.2
Ima Mechanique 2014-03-06 13:24:52 +00:00
parent 5067f1eed9
commit 76aa75974f
2 changed files with 27 additions and 13 deletions

View File

@ -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())
{
LL_WARNS("SyntaxLSL") << "No Response in Time, still fetching!" << LL_ENDL;
}
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_INFOS("SyntaxLSL")
<< "Hashes are the same, no need to update highlighter." << LL_ENDL;
}
}
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()

View File

@ -79,6 +79,7 @@ public:
void initMenu();
void onRegionChangeInitialiseKeywords();
void onFileFetchedInitialiseKeywords();
virtual void draw();
/*virtual*/ BOOL postBuild();