From c073bad6b29fa3c5167c28c286171a1bda9b5e4a Mon Sep 17 00:00:00 2001 From: Cinder Date: Wed, 14 May 2014 11:04:53 -0600 Subject: Begin syntax coloring personalization --- indra/newview/llfloaterscriptedprefs.cpp | 56 ++++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100644 indra/newview/llfloaterscriptedprefs.cpp (limited to 'indra/newview/llfloaterscriptedprefs.cpp') diff --git a/indra/newview/llfloaterscriptedprefs.cpp b/indra/newview/llfloaterscriptedprefs.cpp new file mode 100644 index 0000000000..39624186bb --- /dev/null +++ b/indra/newview/llfloaterscriptedprefs.cpp @@ -0,0 +1,56 @@ +/** + * @file llfloaterscriptedprefs.cpp + * @brief Color controls for the script editor + * @author Cinder Roxley + * + * $LicenseInfo:firstyear=2006&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2014, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA + * $/LicenseInfo$ + */ + +#include "llviewerprecompiledheaders.h" +#include "llfloaterscriptedprefs.h" + +#include "llcolorswatch.h" + + +LLFloaterScriptEdPrefs::LLFloaterScriptEdPrefs(const LLSD& key) +: LLFloater(key) +{ + mCommitCallbackRegistrar.add("ScriptPref.applyUIColor", boost::bind(&LLFloaterScriptEdPrefs::applyUIColor, this ,_1, _2)); + mCommitCallbackRegistrar.add("ScriptPref.getUIColor", boost::bind(&LLFloaterScriptEdPrefs::getUIColor, this ,_1, _2)); +} + +BOOL LLFloaterScriptEdPrefs::postBuild() +{ + return TRUE; +} + +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. +} + +void LLFloaterScriptEdPrefs::getUIColor(LLUICtrl* ctrl, const LLSD& param) +{ + LLColorSwatchCtrl* color_swatch = dynamic_cast(ctrl); + color_swatch->setOriginal(LLUIColorTable::instance().getColor(param.asString())); +} -- cgit v1.2.3 From 4ce0f6d6eac3817e586bee1edd42ae80aaf21f4f Mon Sep 17 00:00:00 2001 From: Cinder Date: Wed, 14 May 2014 21:24:23 -0600 Subject: Color syntax in script colors floater --- indra/newview/llfloaterscriptedprefs.cpp | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'indra/newview/llfloaterscriptedprefs.cpp') diff --git a/indra/newview/llfloaterscriptedprefs.cpp b/indra/newview/llfloaterscriptedprefs.cpp index 39624186bb..12d4bd6faf 100644 --- a/indra/newview/llfloaterscriptedprefs.cpp +++ b/indra/newview/llfloaterscriptedprefs.cpp @@ -29,6 +29,7 @@ #include "llfloaterscriptedprefs.h" #include "llcolorswatch.h" +#include "llscripteditor.h" LLFloaterScriptEdPrefs::LLFloaterScriptEdPrefs(const LLSD& key) @@ -40,6 +41,12 @@ LLFloaterScriptEdPrefs::LLFloaterScriptEdPrefs(const LLSD& key) BOOL LLFloaterScriptEdPrefs::postBuild() { + LLScriptEditor* editor = getChild("Script Preview"); + if (editor) + { + editor->initKeywords(); + editor->loadKeywords(); + } return TRUE; } -- cgit v1.2.3 From f697eb375e3b72f9b57cd5071552035c82bb3f0c Mon Sep 17 00:00:00 2001 From: Cinder Date: Fri, 16 May 2014 09:27:37 -0600 Subject: Update syntax coloring in the preview script on the fly. --- indra/newview/llfloaterscriptedprefs.cpp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'indra/newview/llfloaterscriptedprefs.cpp') diff --git a/indra/newview/llfloaterscriptedprefs.cpp b/indra/newview/llfloaterscriptedprefs.cpp index 12d4bd6faf..da075aa36c 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("Script Preview"); - if (editor) + mEditor = getChild("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) -- cgit v1.2.3 From ec2b00c2e5fccd7432ef1b5a5ab5c88d098e95f2 Mon Sep 17 00:00:00 2001 From: Cinder Date: Wed, 28 May 2014 12:15:37 -0600 Subject: Don't hardcode black as the default color for syntax --- indra/newview/llfloaterscriptedprefs.cpp | 1 - 1 file changed, 1 deletion(-) (limited to 'indra/newview/llfloaterscriptedprefs.cpp') diff --git a/indra/newview/llfloaterscriptedprefs.cpp b/indra/newview/llfloaterscriptedprefs.cpp index da075aa36c..2484a08626 100644 --- a/indra/newview/llfloaterscriptedprefs.cpp +++ b/indra/newview/llfloaterscriptedprefs.cpp @@ -54,7 +54,6 @@ BOOL LLFloaterScriptEdPrefs::postBuild() 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(); } -- cgit v1.2.3