From f697eb375e3b72f9b57cd5071552035c82bb3f0c Mon Sep 17 00:00:00 2001
From: Cinder <cinder.roxley@phoenixviewer.com>
Date: Fri, 16 May 2014 09:27:37 -0600
Subject: [PATCH] Update syntax coloring in the preview script on the fly.

---
 indra/newview/llfloaterscriptedprefs.cpp | 11 +++++++----
 indra/newview/llfloaterscriptedprefs.h   |  3 +++
 2 files changed, 10 insertions(+), 4 deletions(-)

diff --git a/indra/newview/llfloaterscriptedprefs.cpp b/indra/newview/llfloaterscriptedprefs.cpp
index 12d4bd6faf6..da075aa36c6 100644
--- a/indra/newview/llfloaterscriptedprefs.cpp
+++ b/indra/newview/llfloaterscriptedprefs.cpp
@@ -34,6 +34,7 @@
 
 LLFloaterScriptEdPrefs::LLFloaterScriptEdPrefs(const LLSD& key)
 :	LLFloater(key)
+,	mEditor(NULL)
 {
 	mCommitCallbackRegistrar.add("ScriptPref.applyUIColor",	boost::bind(&LLFloaterScriptEdPrefs::applyUIColor, this ,_1, _2));
 	mCommitCallbackRegistrar.add("ScriptPref.getUIColor",	boost::bind(&LLFloaterScriptEdPrefs::getUIColor, this ,_1, _2));
@@ -41,11 +42,11 @@ LLFloaterScriptEdPrefs::LLFloaterScriptEdPrefs(const LLSD& key)
 
 BOOL LLFloaterScriptEdPrefs::postBuild()
 {
-	LLScriptEditor* editor = getChild<LLScriptEditor>("Script Preview");
-	if (editor)
+	mEditor = getChild<LLScriptEditor>("Script Preview");
+	if (mEditor)
 	{
-		editor->initKeywords();
-		editor->loadKeywords();
+		mEditor->initKeywords();
+		mEditor->loadKeywords();
 	}
 	return TRUE;
 }
@@ -54,6 +55,8 @@ void LLFloaterScriptEdPrefs::applyUIColor(LLUICtrl* ctrl, const LLSD& param)
 {
 	LLUIColorTable::instance().setColor(param.asString(), LLColor4(ctrl->getValue()));
 	// *TODO: Signal all active script editors to change colors on the fly.
+	mEditor->initKeywords();
+	mEditor->loadKeywords();
 }
 
 void LLFloaterScriptEdPrefs::getUIColor(LLUICtrl* ctrl, const LLSD& param)
diff --git a/indra/newview/llfloaterscriptedprefs.h b/indra/newview/llfloaterscriptedprefs.h
index 765db75abca..31df897aac7 100644
--- a/indra/newview/llfloaterscriptedprefs.h
+++ b/indra/newview/llfloaterscriptedprefs.h
@@ -30,6 +30,7 @@
 
 #include "llfloater.h"
 
+class LLScriptEditor;
 class LLUICtrl;
 
 class LLFloaterScriptEdPrefs : public LLFloater
@@ -43,6 +44,8 @@ class LLFloaterScriptEdPrefs : public LLFloater
 	
 	void applyUIColor(LLUICtrl* ctrl, const LLSD& param);
 	void getUIColor(LLUICtrl* ctrl, const LLSD& param);
+	
+	LLScriptEditor* mEditor;
 };
 
 #endif // LL_FLOATERSCRIPTEDPREFS_H
-- 
GitLab