summaryrefslogtreecommitdiff
path: root/indra/newview
diff options
context:
space:
mode:
authorCinder <cinder.roxley@phoenixviewer.com>2014-04-18 23:13:57 -0600
committerCinder <cinder.roxley@phoenixviewer.com>2014-04-18 23:13:57 -0600
commitdcffb97518cb2888489c93b90862518f761967dd (patch)
tree5d4afbda134d7c0f63c48abcd6aa211f8d4fb782 /indra/newview
parent54c7b96bf19efd28cc7ce81c0864ee7bbb7d6b1d (diff)
Move some more script editor functions from LLTextEditor to LLScriptEditor
Diffstat (limited to 'indra/newview')
-rwxr-xr-xindra/newview/llpreviewscript.cpp3
-rw-r--r--indra/newview/llscripteditor.cpp44
-rw-r--r--indra/newview/llscripteditor.h14
-rwxr-xr-xindra/newview/skins/default/xui/en/floater_region_debug_console.xml1
-rwxr-xr-xindra/newview/skins/default/xui/en/panel_script_ed.xml1
-rw-r--r--indra/newview/skins/default/xui/en/script_editor.xml4
6 files changed, 60 insertions, 7 deletions
diff --git a/indra/newview/llpreviewscript.cpp b/indra/newview/llpreviewscript.cpp
index 0d95874406..e778015965 100755
--- a/indra/newview/llpreviewscript.cpp
+++ b/indra/newview/llpreviewscript.cpp
@@ -472,8 +472,7 @@ void LLScriptEdCore::processKeywords()
if (mSyntaxIdLSL.isLoaded())
{
- mEditor->mKeywords.initialise(mSyntaxIdLSL.getKeywordsXML());
-
+ mEditor->initKeywords();
mEditor->loadKeywords();
std::vector<std::string> primary_keywords;
diff --git a/indra/newview/llscripteditor.cpp b/indra/newview/llscripteditor.cpp
index 67a43c0ef0..61b5eec9fc 100644
--- a/indra/newview/llscripteditor.cpp
+++ b/indra/newview/llscripteditor.cpp
@@ -28,6 +28,8 @@
#include "linden_common.h"
#include "llscripteditor.h"
+#include "llsyntaxid.h"
+
static LLDefaultChildRegistry::Register<LLScriptEditor> r("script_editor");
LLScriptEditor::LLScriptEditor::Params::Params()
@@ -42,6 +44,48 @@ LLScriptEditor::LLScriptEditor(const Params& p)
}
+void LLScriptEditor::initKeywords()
+{
+ mKeywords.initialise(LLSyntaxIdLSL::getInstance()->getKeywordsXML());
+}
+
+static LLFastTimer::DeclareTimer FTM_SYNTAX_HIGHLIGHTING("Syntax Highlighting");
+
+void LLScriptEditor::loadKeywords()
+{
+ LLFastTimer ft(FTM_SYNTAX_HIGHLIGHTING);
+ mKeywords.processTokens();
+
+ segment_vec_t segment_list;
+ mKeywords.findSegments(&segment_list, getWText(), mDefaultColor.get(), *this);
+
+ mSegments.clear();
+ segment_set_t::iterator insert_it = mSegments.begin();
+ for (segment_vec_t::iterator list_it = segment_list.begin(); list_it != segment_list.end(); ++list_it)
+ {
+ insert_it = mSegments.insert(insert_it, *list_it);
+ }
+}
+
+void LLScriptEditor::updateSegments()
+{
+ if (mReflowIndex < S32_MAX && mKeywords.isLoaded() && mParseOnTheFly)
+ {
+ LLFastTimer ft(FTM_SYNTAX_HIGHLIGHTING);
+ // HACK: No non-ascii keywords for now
+ segment_vec_t segment_list;
+ mKeywords.findSegments(&segment_list, getWText(), mDefaultColor.get(), *this);
+
+ clearSegments();
+ for (segment_vec_t::iterator list_it = segment_list.begin(); list_it != segment_list.end(); ++list_it)
+ {
+ insertSegment(*list_it);
+ }
+ }
+
+ LLTextBase::updateSegments();
+}
+
void LLScriptEditor::clearSegments()
{
if (!mSegments.empty())
diff --git a/indra/newview/llscripteditor.h b/indra/newview/llscripteditor.h
index a0bee36a25..86c915d6a0 100644
--- a/indra/newview/llscripteditor.h
+++ b/indra/newview/llscripteditor.h
@@ -41,11 +41,21 @@ public:
};
virtual ~LLScriptEditor() {};
- void clearSegments();
+ void initKeywords();
+ void loadKeywords();
+ void clearSegments();
+ LLKeywords::keyword_iterator_t keywordsBegin() { return mKeywords.begin(); }
+ LLKeywords::keyword_iterator_t keywordsEnd() { return mKeywords.end(); }
protected:
LLScriptEditor(const Params& p);
-
+
+private:
+ void updateSegments();
+ void loadKeywords(const std::string& filename_keywords,
+ const std::string& filename_colors);
+
+ LLKeywords mKeywords;
};
#endif // LL_SCRIPTEDITOR_H
diff --git a/indra/newview/skins/default/xui/en/floater_region_debug_console.xml b/indra/newview/skins/default/xui/en/floater_region_debug_console.xml
index 99b812a880..11172d8a3e 100755
--- a/indra/newview/skins/default/xui/en/floater_region_debug_console.xml
+++ b/indra/newview/skins/default/xui/en/floater_region_debug_console.xml
@@ -21,7 +21,6 @@
layout="topleft"
max_length="65536"
name="region_debug_console_output"
- show_line_numbers="false"
word_wrap="true"
track_end="true"
read_only="true">
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 3e88e2dc04..1a4f0aff73 100755
--- a/indra/newview/skins/default/xui/en/panel_script_ed.xml
+++ b/indra/newview/skins/default/xui/en/panel_script_ed.xml
@@ -161,7 +161,6 @@
name="Script Editor"
text_readonly_color="DkGray"
width="487"
- show_line_numbers="true"
enable_tooltip_paste="true"
word_wrap="true">
Loading...
diff --git a/indra/newview/skins/default/xui/en/script_editor.xml b/indra/newview/skins/default/xui/en/script_editor.xml
index d24833e85c..b030a117fc 100644
--- a/indra/newview/skins/default/xui/en/script_editor.xml
+++ b/indra/newview/skins/default/xui/en/script_editor.xml
@@ -1,5 +1,7 @@
<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
<script_editor
name="script_editor"
- parse_urls="false">
+ parse_urls="false"
+ show_context_menu="true"
+ show_line_numbers="true">
</script_editor>