summaryrefslogtreecommitdiff
path: root/indra
diff options
context:
space:
mode:
authorIma Mechanique <ima.mechanique@secondlife.com>2013-06-27 21:28:52 +0100
committerIma Mechanique <ima.mechanique@secondlife.com>2013-06-27 21:28:52 +0100
commit7d5ed4f7477c2c564f0e9dededf7131ed42d55b8 (patch)
tree7e7539ca6f03d75102bdf1dd8924ccd893894dea /indra
parentb615858d6c41c29b3b610ec0dba09f30b1f8b3a8 (diff)
Moving LSL highlighting colour info into .../skins/default/colors.xml where it makes more sense than its own xml file. Changing other functions to read it.
Diffstat (limited to 'indra')
-rwxr-xr-xindra/llui/llkeywords.cpp90
-rwxr-xr-xindra/llui/llkeywords.h23
-rwxr-xr-xindra/llui/lltexteditor.cpp2
-rwxr-xr-xindra/llui/lltexteditor.h2
-rw-r--r--indra/newview/app_settings/keywords_lsl_colors.xml176
-rwxr-xr-xindra/newview/skins/default/colors.xml53
6 files changed, 113 insertions, 233 deletions
diff --git a/indra/llui/llkeywords.cpp b/indra/llui/llkeywords.cpp
index b7eb4c63bc..521134f26c 100755
--- a/indra/llui/llkeywords.cpp
+++ b/indra/llui/llkeywords.cpp
@@ -71,7 +71,6 @@ inline BOOL LLKeywordToken::isTail(const llwchar* s) const
LLKeywords::LLKeywords() : mLoaded(FALSE)
{
- setFilenameColors( gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS,"keywords_lsl_colors.xml") );
setFilenameSyntax( gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS,"keywords_lsl_tokens.xml") );
}
@@ -84,7 +83,7 @@ LLKeywords::~LLKeywords()
-void LLKeywords::addColorGroup(const std::string key_in, const LLColor3 color)
+void LLKeywords::addColorGroup(const std::string key_in, const LLColor4 color)
{
WStringMapIndex key ( utf8str_to_wstring(key_in) );
mColorGroupMap[key] = color;
@@ -93,7 +92,7 @@ void LLKeywords::addColorGroup(const std::string key_in, const LLColor3 color)
// Add the token as described
void LLKeywords::addToken(LLKeywordToken::TOKEN_TYPE type,
const std::string& key_in,
- const LLColor3& color,
+ const LLColor4& color,
const std::string& tool_tip_in,
const std::string& delimiter_in)
{
@@ -165,33 +164,47 @@ std::string LLKeywords::getAttribute(const std::string& key)
return (it != mAttributes.end()) ? it->second : "";
}
-LLColor3 LLKeywords::getColorGroup(const std::string key_in)
+LLColor4 LLKeywords::getColorGroup(const std::string key_in)
{
- // LLColor3 initialises to Black (0,0,0)
- LLColor3 Colour;
- WStringMapIndex key ( utf8str_to_wstring(key_in) );
- group_color_map_t::iterator it = mColorGroupMap.find(key);
- if (it == mColorGroupMap.end())
- {
- LL_WARNS("Colour lookup") << "'" << key_in << "' not found!" << LL_ENDL;
- }
- else
- {
- Colour = it->second;
- }
-
- return Colour;
+ std::string ColourGroup = "Black";
+ if (key_in == "constants-float") {
+ ColourGroup = "SyntaxLslConstantFloat";
+ } else if (key_in == "constants-integer") {
+ ColourGroup = "SyntaxLslConstantInteger";
+ } else if (key_in == "constants-key") {
+ ColourGroup = "SyntaxLslConstantKey";
+ } else if (key_in == "constants-string") {
+ ColourGroup = "SyntaxLslConstantRotation";
+ } else if (key_in == "constants-string") {
+ ColourGroup = "SyntaxLslConstantString";
+ } else if (key_in == "constants-vector") {
+ ColourGroup = "SyntaxLslConstantVector";
+ } else if (key_in == "controls") {
+ ColourGroup = "SyntaxLslControlFlow";
+ } else if (key_in == "events") {
+ ColourGroup = "SyntaxLslEvent";
+ } else if (key_in == "functions") {
+ ColourGroup = "SyntaxLslFunction";
+ } else if (key_in == "types") {
+ ColourGroup = "SyntaxLslDataType";
+ } else if (key_in == "sections") {
+ ColourGroup = "SyntaxLslSection";
+ } else if (key_in == "misc-double_quotation_marks") {
+ ColourGroup = "SyntaxLslStringLiteral";
+ } else if (key_in == "misc-comments_1_sided") {
+ ColourGroup = "SyntaxLslComment1Sided";
+ } else if (key_in == "misc-comments_2_sided") {
+ ColourGroup = "SyntaxLslComment2Sided";
+ }
+
+ return LLUIColorTable::instance().getColor(ColourGroup);
}
BOOL LLKeywords::initialise()
{
mReady = false;
- if (! loadIntoLLSD(mFilenameColors, mColors) )
- {
- LL_ERRS("") << "Failed to load color data, cannot continue!" << LL_ENDL;
- }
- else if (! loadIntoLLSD(mFilenameSyntax, mSyntax) )
+ if (! loadIntoLLSD(mFilenameSyntax, mSyntax) )
{
LL_ERRS("") << "Failed to load syntax data from '" << mFilenameSyntax << "', cannot continue!" << LL_ENDL;
}
@@ -199,16 +212,6 @@ BOOL LLKeywords::initialise()
{
mReady = true;
}
-
- if (ready())
- {
- processColors();
- }
- else
- {
- LL_ERRS("") << LL_ENDL;
- LL_ERRS("") << "Failed to load one or both data files, cannot continue!" << LL_ENDL;
- }
return mReady;
}
@@ -251,7 +254,7 @@ BOOL LLKeywords::loadIntoLLSD(const std::string& filename, LLSD& data)
/**
* @brief Start processing the colour LLSD from its beginning.
*
- */
+ * /
std::string LLKeywords::processColors()
{
return processColors(mColors, "");
@@ -261,7 +264,7 @@ std::string LLKeywords::processColors()
* @brief Recursively process the colour LLSD from an arbitrary level.
* @desc Process the supplied LLSD for colour data. The strPrefix is a string
* of hyphen separated keys from previous levels.
- */
+ * /
std::string LLKeywords::processColors(LLSD &settings, const std::string strPrefix)
{
if (settings.isMap() || (! settings.isMap() && strPrefix != "") )
@@ -299,12 +302,13 @@ std::string LLKeywords::processColors(LLSD &settings, const std::string strPrefi
}
return strPrefix;
}
+*/
void LLKeywords::processTokens()
{
// Add 'standard' stuff: Quotes, Comments, Strings, Labels, etc. before processing the LLSD
std::string delimiter;
- addToken(LLKeywordToken::TT_LABEL, "@", getColorGroup("label"), "Label\nTarget for jump statement", delimiter );
+ addToken(LLKeywordToken::TT_LABEL, "@", getColorGroup("misc-flow-label"), "Label\nTarget for jump statement", delimiter );
addToken(LLKeywordToken::TT_ONE_SIDED_DELIMITER, "//", getColorGroup("misc-comments_1_sided"), "Comment (single-line)\nNon-functional commentary or disabled code", delimiter );
addToken(LLKeywordToken::TT_TWO_SIDED_DELIMITER, "/*", getColorGroup("misc-comments_2_sided"), "Comment (multi-line)\nNon-functional commentary or disabled code", "*/" );
addToken(LLKeywordToken::TT_DOUBLE_QUOTATION_MARKS, "\"", getColorGroup("misc-double_quotation_marks"), "String literal", "\"" );
@@ -344,7 +348,7 @@ void LLKeywords::processTokens()
void LLKeywords::processTokensGroup(LLSD& Tokens, const std::string Group)
{
- LLColor3 Color = getColorGroup(Group);
+ LLColor4 Color;
LL_INFOS("Tokens") << "Group: '" << Group << "', using colour: '" << Color << "'" << LL_ENDL;
LLKeywordToken::TOKEN_TYPE token_type = LLKeywordToken::TT_UNKNOWN;
@@ -534,7 +538,7 @@ bool LLKeywords::WStringMapIndex::operator<(const LLKeywords::WStringMapIndex &o
return result;
}
-LLColor3 LLKeywords::readColor( const std::string& s )
+LLColor4 LLKeywords::readColor( const std::string& s )
{
F32 r, g, b;
r = g = b = 0.0f;
@@ -543,22 +547,22 @@ LLColor3 LLKeywords::readColor( const std::string& s )
{
llinfos << " poorly formed color in keyword file" << llendl;
}
- return LLColor3( r, g, b );
+ return LLColor4( r, g, b, 1.f);
}
-LLColor3 LLKeywords::readColor(LLSD& sd)
+LLColor4 LLKeywords::readColor(LLSD& sd)
{
if (sd.isArray())
{
- return LLColor3 (sd);
+ return LLColor4 (sd, 1.f);
}
else if (sd.isMap())
{
- return LLColor3 ( sd.get("x").asReal(), sd.get("y").asReal(), sd.get("z").asReal() );
+ return LLColor4 ( sd.get("x").asReal(), sd.get("y").asReal(), sd.get("z").asReal(), 1.f );
}
else
{
- return LLColor3::black;
+ return LLColor4::black;
}
}
diff --git a/indra/llui/llkeywords.h b/indra/llui/llkeywords.h
index badbd2ae85..6889b95339 100755
--- a/indra/llui/llkeywords.h
+++ b/indra/llui/llkeywords.h
@@ -30,6 +30,7 @@
#include "llstring.h"
#include "v3color.h"
+#include "v4color.h"
#include <map>
#include <list>
#include <deque>
@@ -69,7 +70,7 @@ public:
TT_TYPE // WORD
};
- LLKeywordToken( TOKEN_TYPE type, const LLColor3& color, const LLWString& token, const LLWString& tool_tip, const LLWString& delimiter )
+ LLKeywordToken( TOKEN_TYPE type, const LLColor4& color, const LLWString& token, const LLWString& tool_tip, const LLWString& delimiter )
:
mType( type ),
mToken( token ),
@@ -84,7 +85,7 @@ public:
BOOL isHead(const llwchar* s) const;
BOOL isTail(const llwchar* s) const;
const LLWString& getToken() const { return mToken; }
- const LLColor3& getColor() const { return mColor; }
+ const LLColor4& getColor() const { return mColor; }
TOKEN_TYPE getType() const { return mType; }
const LLWString& getToolTip() const { return mToolTip; }
const LLWString& getDelimiter() const { return mDelimiter; }
@@ -96,7 +97,7 @@ public:
private:
TOKEN_TYPE mType;
LLWString mToken;
- LLColor3 mColor;
+ LLColor4 mColor;
LLWString mToolTip;
LLWString mDelimiter;
};
@@ -107,12 +108,11 @@ public:
LLKeywords();
~LLKeywords();
- void addColorGroup(const std::string key_in, const LLColor3 color);
- LLColor3 getColorGroup(const std::string key_in);
+ void addColorGroup(const std::string key_in, const LLColor4 color);
+ LLColor4 getColorGroup(const std::string key_in);
BOOL loadFromFile();
BOOL loadFromFile(const std::string& filename);
BOOL isLoaded() const { return mLoaded; }
- void setFilenameColors(const std::string filename) { mFilenameColors = filename; }
void setFilenameSyntax(const std::string filename) { mFilenameSyntax = filename; }
void findSegments(std::vector<LLTextSegmentPtr> *seg_list, const LLWString& text, const LLColor4 &defaultColor, class LLTextEditor& editor );
@@ -124,7 +124,7 @@ public:
// Add the token as described
void addToken(LLKeywordToken::TOKEN_TYPE type,
const std::string& key,
- const LLColor3& color,
+ const LLColor4& color,
const std::string& tool_tip = LLStringUtil::null,
const std::string& delimiter = LLStringUtil::null);
@@ -153,7 +153,7 @@ public:
bool mOwner;
- LLColor3 mColor;
+ LLColor4 mColor;
};
typedef std::map<WStringMapIndex, LLKeywordToken*> word_token_map_t;
@@ -161,7 +161,7 @@ public:
keyword_iterator_t begin() const { return mWordTokenMap.begin(); }
keyword_iterator_t end() const { return mWordTokenMap.end(); }
- typedef std::map<WStringMapIndex, LLColor3> group_color_map_t;
+ typedef std::map<WStringMapIndex, LLColor4> group_color_map_t;
typedef group_color_map_t::const_iterator color_iterator_t;
group_color_map_t mColorGroupMap;
@@ -171,8 +171,8 @@ public:
protected:
void processTokensGroup(LLSD& Tokens, const std::string Group);
- LLColor3 readColor(const std::string& s);
- LLColor3 readColor(LLSD& sd);
+ LLColor4 readColor(const std::string& s);
+ LLColor4 readColor(LLSD& sd);
void insertSegment(std::vector<LLTextSegmentPtr>& seg_list, LLTextSegmentPtr new_segment, S32 text_len, const LLColor4 &defaultColor, class LLTextEditor& editor);
void insertSegments(const LLWString& wtext, std::vector<LLTextSegmentPtr>& seg_list, LLKeywordToken* token, S32 text_len, S32 seg_start, S32 seg_end, const LLColor4 &defaultColor, LLTextEditor& editor);
BOOL loadIntoLLSD( const std::string& filename, LLSD& data );
@@ -195,7 +195,6 @@ protected:
private:
BOOL ready() { return mReady; };
BOOL mReady;
- std::string mFilenameColors;
std::string mFilenameSyntax;
};
diff --git a/indra/llui/lltexteditor.cpp b/indra/llui/lltexteditor.cpp
index d3f97dcac8..83d89af4b0 100755
--- a/indra/llui/lltexteditor.cpp
+++ b/indra/llui/lltexteditor.cpp
@@ -2488,7 +2488,7 @@ static LLFastTimer::DeclareTimer FTM_SYNTAX_HIGHLIGHTING("Syntax Highlighting");
void LLTextEditor::loadKeywords(const std::string& filename,
const std::vector<std::string>& funcs,
const std::vector<std::string>& tooltips,
- const LLColor3& color)
+ const LLColor4& color)
{
LLFastTimer ft(FTM_SYNTAX_HIGHLIGHTING);
if(mKeywords.loadFromFile())
diff --git a/indra/llui/lltexteditor.h b/indra/llui/lltexteditor.h
index a6ed39eef8..2a0a0d524f 100755
--- a/indra/llui/lltexteditor.h
+++ b/indra/llui/lltexteditor.h
@@ -190,7 +190,7 @@ public:
void loadKeywords(const std::string& filename,
const std::vector<std::string>& funcs,
const std::vector<std::string>& tooltips,
- const LLColor3& func_color);
+ const LLColor4& func_color);
LLKeywords::keyword_iterator_t keywordsBegin() { return mKeywords.begin(); }
LLKeywords::keyword_iterator_t keywordsEnd() { return mKeywords.end(); }
diff --git a/indra/newview/app_settings/keywords_lsl_colors.xml b/indra/newview/app_settings/keywords_lsl_colors.xml
deleted file mode 100644
index d150f0850f..0000000000
--- a/indra/newview/app_settings/keywords_lsl_colors.xml
+++ /dev/null
@@ -1,176 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<?xml-model href="llsd.rng" type="application/xml" schematypens="http://relaxng.org/ns/structure/1.0"?>
-<llsd>
- <map>
- <key>types</key>
- <map>
- <key>color</key>
- <array>
- <real>0.1</real>
- <real>0.3</real>
- <real>0.1</real>
- </array>
- </map>
-
- <key>constants</key>
- <map>
- <key>float</key>
- <map>
- <key>color</key>
- <array>
- <real>0.3</real>
- <real>0.1</real>
- <real>0.5</real>
- </array>
- </map>
- <key>integer</key>
- <map>
- <key>color</key>
- <array>
- <real>0.1</real>
- <real>0.1</real>
- <real>0.5</real>
- </array>
- </map>
- <key>key</key>
- <map>
- <key>color</key>
- <array>
- <real>0.1</real>
- <real>0.3</real>
- <real>0.5</real>
- </array>
- </map>
- <key>rotation</key>
- <map>
- <key>color</key>
- <array>
- <real>0.4</real>
- <real>0.2</real>
- <real>0.4</real>
- </array>
- </map>
- <key>string</key>
- <map>
- <key>color</key>
- <array>
- <real>0.1</real>
- <real>0.3</real>
- <real>0.5</real>
- </array>
- </map>
- <key>vector</key>
- <map>
- <key>color</key>
- <array>
- <real>0.4</real>
- <real>0.2</real>
- <real>0.4</real>
- </array>
- </map>
- </map>
-
- <key>misc</key>
- <map>
- <key>flow-control</key>
- <map>
- <key>color</key>
- <array>
- <real>0.0</real>
- <real>0.0</real>
- <real>0.8</real>
- </array>
- </map>
-
- <key>comments_1_sided</key>
- <map>
- <key>color</key>
- <array>
- <real>0.8</real>
- <real>0.3</real>
- <real>0.15</real>
- </array>
- </map>
-
- <key>comments_2_sided</key>
- <map>
- <key>color</key>
- <array>
- <real>0.8</real>
- <real>0.3</real>
- <real>0.15</real>
- </array>
- </map>
-
- <key>flow-label</key>
- <map>
- <key>color</key>
- <array>
- <real>0.0</real>
- <real>0.0</real>
- <real>0.8</real>
- </array>
- </map>
-
- <key>double_quotation_marks</key>
- <map>
- <key>color</key>
- <array>
- <real>0.0</real>
- <real>0.2</real>
- <real>0.0</real>
- </array>
- </map>
-
- <key>sections</key>
- <map>
- <key>color</key>
- <array>
- <real>0.5</real>
- <real>0.1</real>
- <real>0.3</real>
- </array>
- </map>
- </map>
-
- <key>events</key>
- <map>
- <key>color</key>
- <array>
- <real>0.0</real>
- <real>0.3</real>
- <real>0.5</real>
- </array>
- </map>
-
- <key>functions</key>
- <map>
- <key>color</key>
- <array>
- <real>0.5</real>
- <real>0.0</real>
- <real>0.15</real>
- </array>
- </map>
-
- <key>deprecated</key>
- <map>
- <key>color</key>
- <array>
- <real>0.9</real>
- <real>0.4</real>
- <real>0.55</real>
- </array>
- </map>
-
- <key>god_mode</key>
- <map>
- <key>color</key>
- <array>
- <real>0.7</real>
- <real>0.2</real>
- <real>0.35</real>
- </array>
- </map>
- </map>
-</llsd>
diff --git a/indra/newview/skins/default/colors.xml b/indra/newview/skins/default/colors.xml
index a9176595c7..fe794c18c5 100755
--- a/indra/newview/skins/default/colors.xml
+++ b/indra/newview/skins/default/colors.xml
@@ -884,4 +884,57 @@
<color
name="blue"
value="0 0 1 1"/>
+
+ <!-- syntax highlighting (LSL Scripts) -->
+ <color
+ name="SyntaxLslComment1Sided"
+ value=".8 .3 .15 1.0" />
+ <color
+ name="SyntaxLslComment2Sided"
+ value=".8 .3 .15 1.0" />
+ <color
+ name="SyntaxLslConstantFloat"
+ value=".3 .1 .5 1.0" />
+ <color
+ name="SyntaxLslConstantInteger"
+ value=".1 .1 .5 1.0" />
+ <color
+ name="SyntaxLslConstantKey"
+ value=".1 .3 .5 1.0" />
+ <color
+ name="SyntaxLslConstantRotation"
+ value=".2 .4 .2 1.0" />
+ <color
+ name="SyntaxLslConstantString"
+ value=".1 .3 .5 1.0" />
+ <color
+ name="SyntaxLslConstantVector"
+ value=".2 .4 .2 1.0" />
+ <color
+ name="SyntaxLslControlFlow"
+ value="0 0 .8 1.0" />
+ <color
+ name="SyntaxLslControlLabel"
+ value="0 0 .8 1.0" />
+ <color
+ name="SyntaxLslDataType"
+ value=".1 .3 .1 1.0" />
+ <color
+ name="SyntaxLslDeprecated"
+ value=".9 .4 .55 1.0" />
+ <color
+ name="SyntaxLslEvent"
+ value="0 .3 .5 1.0" />
+ <color
+ name="SyntaxLslFunction"
+ value=".3 0 .5 1.0" />
+ <color
+ name="SyntaxLslGodMode"
+ value="0.7 .2 .35 1.0" />
+ <color
+ name="SyntaxLslSection"
+ value=".5 .1 .3 1.0" />
+ <color
+ name="SyntaxLslStringLiteral"
+ value="0 .2 0 1.0" />
</colors>