diff options
author | Leyla Farazha <leyla@lindenlab.com> | 2010-06-21 11:24:33 -0700 |
---|---|---|
committer | Leyla Farazha <leyla@lindenlab.com> | 2010-06-21 11:24:33 -0700 |
commit | a6cf0bed743f02af370ec81cd56ed81928a7f8ec (patch) | |
tree | 66562b72586081f59fa74e9baaedf560ff49ffd5 /indra/llui/lltextbase.cpp | |
parent | b770415b6a2f52946eafb99800af7409b900cd8e (diff) | |
parent | bb95afc9e1246abfc3656b31b33d1e5ae1dc85f2 (diff) |
Merge from ssh://hg.lindenlab.com/dessie/viewer-release
Diffstat (limited to 'indra/llui/lltextbase.cpp')
-rw-r--r-- | indra/llui/lltextbase.cpp | 39 |
1 files changed, 13 insertions, 26 deletions
diff --git a/indra/llui/lltextbase.cpp b/indra/llui/lltextbase.cpp index 3c6c7d3e82..2d0d5c12cb 100644 --- a/indra/llui/lltextbase.cpp +++ b/indra/llui/lltextbase.cpp @@ -152,6 +152,7 @@ LLTextBase::Params::Params() bg_writeable_color("bg_writeable_color"), bg_focus_color("bg_focus_color"), allow_scroll("allow_scroll", true), + plain_text("plain_text",false), track_end("track_end", false), read_only("read_only", false), v_pad("v_pad", 0), @@ -200,6 +201,7 @@ LLTextBase::LLTextBase(const LLTextBase::Params &p) mSelectionStart( 0 ), mSelectionEnd( 0 ), mIsSelecting( FALSE ), + mPlainText ( p.plain_text ), mWordWrap(p.wrap), mUseEllipses( p.use_ellipses ), mParseHTML(p.allow_html), @@ -1614,7 +1616,7 @@ void LLTextBase::appendTextImpl(const std::string &new_text, const LLStyle::Para part = (S32)LLTextParser::MIDDLE; } std::string subtext=text.substr(0,start); - appendAndHighlightTextImpl(subtext, part, style_params); + appendAndHighlightText(subtext, part, style_params); } // output an optional icon before the Url @@ -1635,11 +1637,11 @@ void LLTextBase::appendTextImpl(const std::string &new_text, const LLStyle::Para // output the styled Url (unless we've been asked to suppress hyperlinking) if (match.isLinkDisabled()) { - appendAndHighlightTextImpl(match.getLabel(), part, style_params); + appendAndHighlightText(match.getLabel(), part, style_params); } else { - appendAndHighlightTextImpl(match.getLabel(), part, link_params); + appendAndHighlightText(match.getLabel(), part, link_params); // set the tooltip for the Url label if (! match.getTooltip().empty()) @@ -1667,11 +1669,11 @@ void LLTextBase::appendTextImpl(const std::string &new_text, const LLStyle::Para if (part != (S32)LLTextParser::WHOLE) part=(S32)LLTextParser::END; if (end < (S32)text.length()) - appendAndHighlightTextImpl(text, part, style_params); + appendAndHighlightText(text, part, style_params); } else { - appendAndHighlightTextImpl(new_text, part, style_params); + appendAndHighlightText(new_text, part, style_params); } } @@ -1682,23 +1684,7 @@ void LLTextBase::appendText(const std::string &new_text, bool prepend_newline, c if(prepend_newline) appendLineBreakSegment(input_params); - std::string::size_type start = 0; - std::string::size_type pos = new_text.find("\n",start); - - while(pos!=-1) - { - if(pos!=start) - { - std::string str = std::string(new_text,start,pos-start); - appendTextImpl(str,input_params); - } - appendLineBreakSegment(input_params); - start = pos+1; - pos = new_text.find("\n",start); - } - - std::string str = std::string(new_text,start,new_text.length()-start); - appendTextImpl(str,input_params); + appendTextImpl(new_text,input_params); } void LLTextBase::needsReflow(S32 index) @@ -1718,6 +1704,10 @@ void LLTextBase::appendLineBreakSegment(const LLStyle::Params& style_params) void LLTextBase::appendImageSegment(S32 highlight_part, const LLStyle::Params& style_params) { + if(getPlainText()) + { + return; + } segment_vec_t segments; LLStyleConstSP sp(new LLStyle(style_params)); segments.push_back(new LLImageTextSegment(sp, getLength(),*this)); @@ -1797,13 +1787,10 @@ void LLTextBase::appendAndHighlightTextImpl(const std::string &new_text, S32 hig } } -void LLTextBase::appendAndHighlightText(const std::string &new_text, bool prepend_newline, S32 highlight_part, const LLStyle::Params& style_params) +void LLTextBase::appendAndHighlightText(const std::string &new_text, S32 highlight_part, const LLStyle::Params& style_params) { if (new_text.empty()) return; - if(prepend_newline) - appendLineBreakSegment(style_params); - std::string::size_type start = 0; std::string::size_type pos = new_text.find("\n",start); |