summaryrefslogtreecommitdiff
path: root/indra/llui
diff options
context:
space:
mode:
authorJosh Bell <josh@lindenlab.com>2007-12-29 01:40:57 +0000
committerJosh Bell <josh@lindenlab.com>2007-12-29 01:40:57 +0000
commitd06e5e3519f13197dd62bfbabf76f7efcc3d7a79 (patch)
tree62b363ba11a3cc7dd78343e63ad440284f0252f3 /indra/llui
parent79680891a73be074aa449a9ccdf695b0afd300d8 (diff)
svn merge -r 76642:76643 svn+ssh://svn.lindenlab.com/svn/linden/qa/maintenance-4-merge-76640
Redo of QAR-170, with correct range. Reviewed by CG.
Diffstat (limited to 'indra/llui')
-rw-r--r--indra/llui/llkeywords.cpp14
-rw-r--r--indra/llui/llkeywords.h4
-rw-r--r--indra/llui/lltexteditor.cpp6
-rw-r--r--indra/llui/lltexteditor.h2
4 files changed, 15 insertions, 11 deletions
diff --git a/indra/llui/llkeywords.cpp b/indra/llui/llkeywords.cpp
index 5efb8bed06..85d8f4b5c2 100644
--- a/indra/llui/llkeywords.cpp
+++ b/indra/llui/llkeywords.cpp
@@ -233,7 +233,7 @@ LLColor3 LLKeywords::readColor( const LLString& s )
// Walk through a string, applying the rules specified by the keyword token list and
// create a list of color segments.
-void LLKeywords::findSegments(std::vector<LLTextSegment *>* seg_list, const LLWString& wtext)
+void LLKeywords::findSegments(std::vector<LLTextSegment *>* seg_list, const LLWString& wtext, const LLColor4 &defaultColor)
{
std::for_each(seg_list->begin(), seg_list->end(), DeletePointer());
seg_list->clear();
@@ -245,7 +245,7 @@ void LLKeywords::findSegments(std::vector<LLTextSegment *>* seg_list, const LLWS
S32 text_len = wtext.size();
- seg_list->push_back( new LLTextSegment( LLColor3(0,0,0), 0, text_len ) );
+ seg_list->push_back( new LLTextSegment( LLColor3(defaultColor), 0, text_len ) );
const llwchar* base = wtext.c_str();
const llwchar* cur = base;
@@ -299,7 +299,7 @@ void LLKeywords::findSegments(std::vector<LLTextSegment *>* seg_list, const LLWS
//llinfos << "Seg: [" << (char*)LLString( base, seg_start, seg_end-seg_start) << "]" << llendl;
LLTextSegment* text_segment = new LLTextSegment( cur_token->getColor(), seg_start, seg_end );
text_segment->setToken( cur_token );
- insertSegment( seg_list, text_segment, text_len);
+ insertSegment( seg_list, text_segment, text_len, defaultColor);
line_done = TRUE; // to break out of second loop.
break;
}
@@ -409,7 +409,7 @@ void LLKeywords::findSegments(std::vector<LLTextSegment *>* seg_list, const LLWS
//llinfos << "Seg: [" << (char*)LLString( base, seg_start, seg_end-seg_start ) << "]" << llendl;
LLTextSegment* text_segment = new LLTextSegment( cur_delimiter->getColor(), seg_start, seg_end );
text_segment->setToken( cur_delimiter );
- insertSegment( seg_list, text_segment, text_len);
+ insertSegment( seg_list, text_segment, text_len, defaultColor);
// Note: we don't increment cur, since the end of one delimited seg may be immediately
// followed by the start of another one.
@@ -442,7 +442,7 @@ void LLKeywords::findSegments(std::vector<LLTextSegment *>* seg_list, const LLWS
LLTextSegment* text_segment = new LLTextSegment( cur_token->getColor(), seg_start, seg_end );
text_segment->setToken( cur_token );
- insertSegment( seg_list, text_segment, text_len);
+ insertSegment( seg_list, text_segment, text_len, defaultColor);
}
cur += seg_len;
continue;
@@ -457,7 +457,7 @@ void LLKeywords::findSegments(std::vector<LLTextSegment *>* seg_list, const LLWS
}
}
-void LLKeywords::insertSegment(std::vector<LLTextSegment*>* seg_list, LLTextSegment* new_segment, S32 text_len )
+void LLKeywords::insertSegment(std::vector<LLTextSegment*>* seg_list, LLTextSegment* new_segment, S32 text_len, const LLColor4 &defaultColor )
{
LLTextSegment* last = seg_list->back();
S32 new_seg_end = new_segment->getEnd();
@@ -475,7 +475,7 @@ void LLKeywords::insertSegment(std::vector<LLTextSegment*>* seg_list, LLTextSegm
if( new_seg_end < text_len )
{
- seg_list->push_back( new LLTextSegment( LLColor3(0,0,0), new_seg_end, text_len ) );
+ seg_list->push_back( new LLTextSegment( defaultColor, new_seg_end, text_len ) );
}
}
diff --git a/indra/llui/llkeywords.h b/indra/llui/llkeywords.h
index 4309f16cae..d279d2e627 100644
--- a/indra/llui/llkeywords.h
+++ b/indra/llui/llkeywords.h
@@ -84,7 +84,7 @@ public:
BOOL loadFromFile(const LLString& filename);
BOOL isLoaded() { return mLoaded; }
- void findSegments(std::vector<LLTextSegment *> *seg_list, const LLWString& text );
+ void findSegments(std::vector<LLTextSegment *> *seg_list, const LLWString& text, const LLColor4 &defaultColor );
#ifdef _DEBUG
void dump();
@@ -98,7 +98,7 @@ public:
private:
LLColor3 readColor(const LLString& s);
- void insertSegment(std::vector<LLTextSegment *> *seg_list, LLTextSegment* new_segment, S32 text_len);
+ void insertSegment(std::vector<LLTextSegment *> *seg_list, LLTextSegment* new_segment, S32 text_len, const LLColor4 &defaultColor);
private:
BOOL mLoaded;
diff --git a/indra/llui/lltexteditor.cpp b/indra/llui/lltexteditor.cpp
index 8b9353eb8e..7cd164ec14 100644
--- a/indra/llui/lltexteditor.cpp
+++ b/indra/llui/lltexteditor.cpp
@@ -302,6 +302,7 @@ LLTextEditor::LLTextEditor(
mOnScrollEndData( NULL ),
mCursorColor( LLUI::sColorsGroup->getColor( "TextCursorColor" ) ),
mFgColor( LLUI::sColorsGroup->getColor( "TextFgColor" ) ),
+ mDefaultColor( LLUI::sColorsGroup->getColor( "TextDefaultColor" ) ),
mReadOnlyFgColor( LLUI::sColorsGroup->getColor( "TextFgReadOnlyColor" ) ),
mWriteableBgColor( LLUI::sColorsGroup->getColor( "TextBgWriteableColor" ) ),
mReadOnlyBgColor( LLUI::sColorsGroup->getColor( "TextBgReadOnlyColor" ) ),
@@ -3799,7 +3800,7 @@ void LLTextEditor::loadKeywords(const LLString& filename,
mKeywords.addToken(LLKeywordToken::WORD, name.c_str(), color, tooltips.get(i) );
}
- mKeywords.findSegments( &mSegments, mWText );
+ mKeywords.findSegments( &mSegments, mWText, mDefaultColor );
llassert( mSegments.front()->getStart() == 0 );
llassert( mSegments.back()->getEnd() == getLength() );
@@ -3811,7 +3812,7 @@ void LLTextEditor::updateSegments()
if (mKeywords.isLoaded())
{
// HACK: No non-ascii keywords for now
- mKeywords.findSegments(&mSegments, mWText);
+ mKeywords.findSegments(&mSegments, mWText, mDefaultColor);
}
else if (mAllowEmbeddedItems)
{
@@ -4192,6 +4193,7 @@ LLXMLNodePtr LLTextEditor::getXML(bool save_children) const
addColorXML(node, mCursorColor, "cursor_color", "TextCursorColor");
addColorXML(node, mFgColor, "text_color", "TextFgColor");
+ addColorXML(node, mDefaultColor, "text_default_color", "TextDefaultColor");
addColorXML(node, mReadOnlyFgColor, "text_readonly_color", "TextFgReadOnlyColor");
addColorXML(node, mReadOnlyBgColor, "bg_readonly_color", "TextBgReadOnlyColor");
addColorXML(node, mWriteableBgColor, "bg_writeable_color", "TextBgWriteableColor");
diff --git a/indra/llui/lltexteditor.h b/indra/llui/lltexteditor.h
index a2ce0d2c47..838154655c 100644
--- a/indra/llui/lltexteditor.h
+++ b/indra/llui/lltexteditor.h
@@ -187,6 +187,7 @@ public:
void setCursorColor(const LLColor4& c) { mCursorColor = c; }
void setFgColor( const LLColor4& c ) { mFgColor = c; }
+ void setTextDefaultColor( const LLColor4& c ) { mDefaultColor = c; }
void setReadOnlyFgColor( const LLColor4& c ) { mReadOnlyFgColor = c; }
void setWriteableBgColor( const LLColor4& c ) { mWriteableBgColor = c; }
void setReadOnlyBgColor( const LLColor4& c ) { mReadOnlyBgColor = c; }
@@ -429,6 +430,7 @@ protected:
LLColor4 mCursorColor;
LLColor4 mFgColor;
+ LLColor4 mDefaultColor;
LLColor4 mReadOnlyFgColor;
LLColor4 mWriteableBgColor;
LLColor4 mReadOnlyBgColor;