summaryrefslogtreecommitdiff
path: root/indra/llui
diff options
context:
space:
mode:
Diffstat (limited to 'indra/llui')
-rwxr-xr-xindra/llui/llkeywords.cpp90
-rwxr-xr-xindra/llui/llkeywords.h23
-rwxr-xr-xindra/llui/lltexteditor.cpp2
-rwxr-xr-xindra/llui/lltexteditor.h2
4 files changed, 60 insertions, 57 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(); }