diff options
| -rw-r--r-- | indra/llui/lltextbase.cpp | 22 | ||||
| -rw-r--r-- | indra/llui/lltextbase.h | 5 | ||||
| -rw-r--r-- | indra/newview/skins/default/xui/en/panel_sys_well_item.xml | 1 | ||||
| -rw-r--r-- | indra/newview/skins/default/xui/en/panel_toast.xml | 2 | ||||
| -rw-r--r-- | indra/newview/skins/default/xui/en/widgets/textbase.xml | 2 | 
5 files changed, 26 insertions, 6 deletions
diff --git a/indra/llui/lltextbase.cpp b/indra/llui/lltextbase.cpp index e515170b0c..02fcac8f69 100644 --- a/indra/llui/lltextbase.cpp +++ b/indra/llui/lltextbase.cpp @@ -156,6 +156,7 @@ LLTextBase::Params::Params()  	read_only("read_only", false),  	v_pad("v_pad", 0),  	h_pad("h_pad", 0), +	clip_partial("clip_partial", true),  	line_spacing("line_spacing"),  	max_text_length("max_length", 255),  	font_shadow("font_shadow"), @@ -193,6 +194,7 @@ LLTextBase::LLTextBase(const LLTextBase::Params &p)  	mHAlign(p.font_halign),  	mLineSpacingMult(p.line_spacing.multiple),  	mLineSpacingPixels(p.line_spacing.pixels), +	mClipPartial(p.clip_partial),  	mTrackEnd( p.track_end ),  	mScrollIndex(-1),  	mSelectionStart( 0 ), @@ -504,7 +506,7 @@ void LLTextBase::drawText()  	}  	LLRect scrolled_view_rect = getVisibleDocumentRect(); -	std::pair<S32, S32> line_range = getVisibleLines(); +	std::pair<S32, S32> line_range = getVisibleLines(mClipPartial);  	S32 first_line = line_range.first;  	S32 last_line = line_range.second;  	if (first_line >= last_line) @@ -524,6 +526,7 @@ void LLTextBase::drawText()  	for (S32 cur_line = first_line; cur_line < last_line; cur_line++)  	{ +		S32 next_line = cur_line + 1;  		line_info& line = mLineInfoList[cur_line];  		if ((line.mRect.mTop - scrolled_view_rect.mBottom) < mTextRect.mBottom)  @@ -534,15 +537,15 @@ void LLTextBase::drawText()  		S32 next_start = -1;  		S32 line_end = text_len; -		if ((cur_line + 1) < getLineCount()) +		if (next_line < getLineCount())  		{ -			next_start = getLineStart(cur_line + 1); +			next_start = getLineStart(next_line);  			line_end = next_start;  		}  		LLRect text_rect(line.mRect.mLeft + mTextRect.mLeft - scrolled_view_rect.mLeft,  						line.mRect.mTop - scrolled_view_rect.mBottom + mTextRect.mBottom, -						mDocumentView->getRect().getWidth() - scrolled_view_rect.mLeft, +						line.mRect.mRight - scrolled_view_rect.mLeft,  						line.mRect.mBottom - scrolled_view_rect.mBottom + mTextRect.mBottom);  		// draw a single line of text @@ -562,6 +565,17 @@ void LLTextBase::drawText()  			}  			S32 clipped_end	=	llmin( line_end, cur_segment->getEnd() )  - cur_segment->getStart(); + +			if (mUseEllipses +				&& clipped_end == line_end  +				&& next_line == last_line  +				&& last_line < (S32)mLineInfoList.size()) +			{ +				// more text to go, but we can't fit it +				// so attempt to draw one extra character to force ellipses +				clipped_end++; +			} +  			text_rect.mLeft = (S32)(cur_segment->draw(seg_start - cur_segment->getStart(), clipped_end, selection_left, selection_right, text_rect));  			seg_start = clipped_end + cur_segment->getStart(); diff --git a/indra/llui/lltextbase.h b/indra/llui/lltextbase.h index c376a73615..c60b040655 100644 --- a/indra/llui/lltextbase.h +++ b/indra/llui/lltextbase.h @@ -84,11 +84,13 @@ public:  								wrap,  								use_ellipses,  								allow_html, -								parse_highlights; +								parse_highlights, +								clip_partial;  		Optional<S32>			v_pad,  								h_pad; +  		Optional<LineSpacingParams>  								line_spacing; @@ -347,6 +349,7 @@ protected:  	bool						mTrackEnd;			// if true, keeps scroll position at end of document during resize  	bool						mReadOnly;  	bool						mBGVisible;			// render background? +	bool						mClipPartial;		// false if we show lines that are partially inside bounding rect  	S32							mMaxTextByteLength;	// Maximum length mText is allowed to be in bytes  	// support widgets diff --git a/indra/newview/skins/default/xui/en/panel_sys_well_item.xml b/indra/newview/skins/default/xui/en/panel_sys_well_item.xml index ccb57b6552..2822f7b841 100644 --- a/indra/newview/skins/default/xui/en/panel_sys_well_item.xml +++ b/indra/newview/skins/default/xui/en/panel_sys_well_item.xml @@ -14,6 +14,7 @@    background_visible="true"    bg_alpha_color="0.0 0.0 0.0 0.0" >    <text +    clip_partial="true"       top="2"      left="10"      width="267" diff --git a/indra/newview/skins/default/xui/en/panel_toast.xml b/indra/newview/skins/default/xui/en/panel_toast.xml index f16329f8d7..4293051dbd 100644 --- a/indra/newview/skins/default/xui/en/panel_toast.xml +++ b/indra/newview/skins/default/xui/en/panel_toast.xml @@ -29,6 +29,7 @@    >    <!-- Don't remove this wiget! It is needed for Overflow and Start-Up toasts!-->    <text +    clip_partial="true"      visible="false"     follows="left|top|right|bottom"     font="SansSerifBold" @@ -39,6 +40,7 @@     word_wrap="true"     text_color="white"     top="5"  +    use_ellipses="true"     width="260">      Toast text;    </text> diff --git a/indra/newview/skins/default/xui/en/widgets/textbase.xml b/indra/newview/skins/default/xui/en/widgets/textbase.xml index 6dd92ea34b..166e8555fe 100644 --- a/indra/newview/skins/default/xui/en/widgets/textbase.xml +++ b/indra/newview/skins/default/xui/en/widgets/textbase.xml @@ -1,2 +1,2 @@  <?xml version="1.0" encoding="utf-8" standalone="yes" ?> -<textbase/> +<textbase clip_partial="false"/>  | 
