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/llui/llkeywords.cpp | 4 +- indra/newview/CMakeLists.txt | 2 + indra/newview/llfloaterscriptedprefs.cpp | 56 +++ indra/newview/llfloaterscriptedprefs.h | 48 +++ indra/newview/llviewerfloaterreg.cpp | 2 + indra/newview/skins/default/colors.xml | 12 +- .../default/xui/en/floater_script_ed_prefs.xml | 478 +++++++++++++++++++++ .../skins/default/xui/en/panel_script_ed.xml | 11 +- .../newview/skins/default/xui/en/script_editor.xml | 12 +- 9 files changed, 615 insertions(+), 10 deletions(-) create mode 100644 indra/newview/llfloaterscriptedprefs.cpp create mode 100644 indra/newview/llfloaterscriptedprefs.h create mode 100644 indra/newview/skins/default/xui/en/floater_script_ed_prefs.xml (limited to 'indra') diff --git a/indra/llui/llkeywords.cpp b/indra/llui/llkeywords.cpp index 2d8bd926c0..f633f3e4af 100755 --- a/indra/llui/llkeywords.cpp +++ b/indra/llui/llkeywords.cpp @@ -237,11 +237,11 @@ LLColor4 LLKeywords::getColorGroup(const std::string& key_in) } else if (key_in == "misc-comments_1_sided") { - color_group = "SyntaxLslComment1Sided"; + color_group = "SyntaxLslComment"; } else if (key_in == "misc-comments_2_sided") { - color_group = "SyntaxLslComment2Sided"; + color_group = "SyntaxLslComment"; } else { diff --git a/indra/newview/CMakeLists.txt b/indra/newview/CMakeLists.txt index f0b7584312..1877db6280 100755 --- a/indra/newview/CMakeLists.txt +++ b/indra/newview/CMakeLists.txt @@ -272,6 +272,7 @@ set(viewer_SOURCE_FILES llfloaterregionrestarting.cpp llfloatersceneloadstats.cpp llfloaterscriptdebug.cpp + llfloaterscriptedprefs.cpp llfloaterscriptlimits.cpp llfloatersearch.cpp llfloatersellland.cpp @@ -869,6 +870,7 @@ set(viewer_HEADER_FILES llfloaterregionrestarting.h llfloatersceneloadstats.h llfloaterscriptdebug.h + llfloaterscriptedprefs.h llfloaterscriptlimits.h llfloatersearch.h llfloatersellland.h 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())); +} diff --git a/indra/newview/llfloaterscriptedprefs.h b/indra/newview/llfloaterscriptedprefs.h new file mode 100644 index 0000000000..360c9adc92 --- /dev/null +++ b/indra/newview/llfloaterscriptedprefs.h @@ -0,0 +1,48 @@ +/** + * @file llfloaterscriptedprefs.h + * @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$ + */ + +#ifndef LLFLOATERSCRIPTEDPREFS_H +#define LLFLOATERSCRIPTEDPREFS_H + +#include "llfloater.h" + +class LLUICtrl; + +class LLFloaterScriptEdPrefs : public LLFloater +{ +public: + LLFloaterScriptEdPrefs(const LLSD& key); + BOOL postBuild(); + +private: + ~LLFloaterScriptEdPrefs() {}; + + void applyUIColor(LLUICtrl* ctrl, const LLSD& param); + void getUIColor(LLUICtrl* ctrl, const LLSD& param); +}; + +#endif // LL_FLOATERSCRIPTEDPREFS_H diff --git a/indra/newview/llviewerfloaterreg.cpp b/indra/newview/llviewerfloaterreg.cpp index fae35fe664..3cd5b54aaf 100755 --- a/indra/newview/llviewerfloaterreg.cpp +++ b/indra/newview/llviewerfloaterreg.cpp @@ -98,6 +98,7 @@ #include "llfloaterreporter.h" #include "llfloatersceneloadstats.h" #include "llfloaterscriptdebug.h" +#include "llfloaterscriptedprefs.h" #include "llfloaterscriptlimits.h" #include "llfloatersearch.h" #include "llfloatersellland.h" @@ -282,6 +283,7 @@ void LLViewerFloaterReg::registerFloaters() LLFloaterReg::add("preview_texture", "floater_preview_texture.xml", (LLFloaterBuildFunc)&LLFloaterReg::build, "preview"); LLFloaterReg::add("properties", "floater_inventory_item_properties.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); LLFloaterReg::add("publish_classified", "floater_publish_classified.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); + LLFloaterReg::add("script_colors", "floater_script_ed_prefs.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); LLFloaterReg::add("telehubs", "floater_telehub.xml",&LLFloaterReg::build); LLFloaterReg::add("test_inspectors", "floater_test_inspectors.xml", &LLFloaterReg::build); diff --git a/indra/newview/skins/default/colors.xml b/indra/newview/skins/default/colors.xml index cb1d6aa32b..bdbece33e0 100755 --- a/indra/newview/skins/default/colors.xml +++ b/indra/newview/skins/default/colors.xml @@ -907,10 +907,16 @@ + name="ScriptText" + reference="Black" /> + + + + + Choose desired colors: + + + + + + + + Text + + + + + + + Cursor + + + + + + + Background + + + + + + + Sections + + + + + + + Data Types + + + + + + + Events + + + + + + + Comment + + + + + + + String Literals + + + + + + + + Integer Const + + + + + + + String Const + + + + + + + Float Const + + + + + + + Compound + + + + + + + Flow Control + + + + + + + Function + + + +default +{ + state_entry() + { + llSay(0, "Hello!"); + } +} + + \ No newline at end of file diff --git a/indra/newview/skins/default/xui/en/panel_script_ed.xml b/indra/newview/skins/default/xui/en/panel_script_ed.xml index 76a81c4885..755d9eaf39 100755 --- a/indra/newview/skins/default/xui/en/panel_script_ed.xml +++ b/indra/newview/skins/default/xui/en/panel_script_ed.xml @@ -70,6 +70,16 @@ label="Save to file..." layout="topleft" name="SaveToFile" /> + + + + + name="script_editor" + parse_urls="false" + show_context_menu="true" + show_line_numbers="true" + text_color="ScriptText" + default_color="ScriptText" + bg_writeable_color="ScriptBackground" + bg_focus_color="ScriptBackground"> -- cgit v1.2.3