summaryrefslogtreecommitdiff
path: root/indra
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
parenta2c084849f6c977c4c1c3151e0762c0137d34d0d (diff)
storm-1831 Fixing identificaton of label for highlighting.
Diffstat (limited to 'indra')
-rwxr-xr-xindra/llui/llkeywords.cpp2
-rwxr-xr-xindra/newview/llpreviewscript.cpp72
-rwxr-xr-xindra/newview/llpreviewscript.h18
3 files changed, 60 insertions, 32 deletions
diff --git a/indra/llui/llkeywords.cpp b/indra/llui/llkeywords.cpp
index 6a349f3916..a251c2e4f5 100755
--- a/indra/llui/llkeywords.cpp
+++ b/indra/llui/llkeywords.cpp
@@ -209,7 +209,7 @@ LLColor4 LLKeywords::getColorGroup(const std::string key_in)
{
ColourGroup = "SyntaxLslConstantVector";
}
- else if (key_in == "controls")
+ else if (key_in == "misc-flow-label")
{
ColourGroup = "SyntaxLslControlFlow";
}
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;
}
diff --git a/indra/newview/llpreviewscript.h b/indra/newview/llpreviewscript.h
index 67a4ca52fa..0841c8188b 100755
--- a/indra/newview/llpreviewscript.h
+++ b/indra/newview/llpreviewscript.h
@@ -77,9 +77,12 @@ protected:
public:
~LLScriptEdCore();
+ void clearHighlights();
+ void initialiseKeywords();
void initMenu();
- void onRegionChangeInitialiseKeywords();
- void onFileFetchedInitialiseKeywords();
+ void processKeywords();
+ void processLoaded();
+ void updateKeywords();
virtual void draw();
/*virtual*/ BOOL postBuild();
@@ -133,6 +136,8 @@ protected:
void addHelpItemToHistory(const std::string& help_string);
static void onErrorList(LLUICtrl*, void* user_data);
+ bool mLive;
+
private:
std::string mSampleText;
LLTextEditor* mEditor;
@@ -155,6 +160,10 @@ private:
LLSyntaxIdLSL mSyntaxIdLSL;
LLScriptEdContainer* mContainer; // parent view
+
+public:
+ boost::signals2::connection mRegionChangedCallback;
+
};
class LLScriptEdContainer : public LLPreview
@@ -163,6 +172,7 @@ class LLScriptEdContainer : public LLPreview
public:
LLScriptEdContainer(const LLSD& key);
+ LLScriptEdContainer(const LLSD& key, const bool live);
protected:
std::string getTmpFileName();
@@ -172,7 +182,7 @@ protected:
LLScriptEdCore* mScriptEd;
};
-// Used to view and edit a LSL from your inventory.
+// Used to view and edit an LSL script from your inventory.
class LLPreviewLSL : public LLScriptEdContainer
{
public:
@@ -217,7 +227,7 @@ protected:
};
-// Used to view and edit an LSL that is attached to an object.
+// Used to view and edit an LSL script that is attached to an object.
class LLLiveLSLEditor : public LLScriptEdContainer
{
friend class LLLiveLSLFile;