summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--indra/llui/lltextbase.cpp88
-rw-r--r--indra/llui/lltextbase.h8
-rw-r--r--indra/llui/lltextbox.cpp4
-rw-r--r--indra/llui/lltexteditor.cpp38
-rw-r--r--indra/newview/llchathistory.cpp12
-rw-r--r--indra/newview/lltoastpanel.cpp2
6 files changed, 76 insertions, 76 deletions
diff --git a/indra/llui/lltextbase.cpp b/indra/llui/lltextbase.cpp
index d50abaa83a..ead80658e2 100644
--- a/indra/llui/lltextbase.cpp
+++ b/indra/llui/lltextbase.cpp
@@ -312,7 +312,7 @@ void LLTextBase::drawSelectionBackground()
S32 selection_left = llmin( mSelectionStart, mSelectionEnd );
S32 selection_right = llmax( mSelectionStart, mSelectionEnd );
- LLRect selection_rect = mTextRect;
+ LLRect selection_rect = mVisibleTextRect;
// Skip through the lines we aren't drawing.
LLRect content_display_rect = getVisibleDocumentRect();
@@ -391,7 +391,7 @@ void LLTextBase::drawSelectionBackground()
++rect_it)
{
LLRect selection_rect = *rect_it;
- selection_rect.translate(mTextRect.mLeft - content_display_rect.mLeft, mTextRect.mBottom - content_display_rect.mBottom);
+ selection_rect.translate(mVisibleTextRect.mLeft - content_display_rect.mLeft, mVisibleTextRect.mBottom - content_display_rect.mBottom);
gl_rect_2d(selection_rect, selection_color);
}
}
@@ -538,10 +538,10 @@ void LLTextBase::drawText()
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,
+ LLRect text_rect(line.mRect.mLeft + mVisibleTextRect.mLeft - scrolled_view_rect.mLeft,
+ line.mRect.mTop - scrolled_view_rect.mBottom + mVisibleTextRect.mBottom,
llmin(mDocumentView->getRect().getWidth(), line.mRect.mRight) - scrolled_view_rect.mLeft,
- line.mRect.mBottom - scrolled_view_rect.mBottom + mTextRect.mBottom);
+ line.mRect.mBottom - scrolled_view_rect.mBottom + mVisibleTextRect.mBottom);
// draw a single line of text
S32 seg_start = line_start;
@@ -949,7 +949,7 @@ void LLTextBase::reshape(S32 width, S32 height, BOOL called_from_parent)
LLUICtrl::reshape( width, height, called_from_parent );
// do this first after reshape, because other things depend on
- // up-to-date mTextRect
+ // up-to-date mVisibleTextRect
updateRects();
needsReflow();
@@ -984,7 +984,7 @@ void LLTextBase::draw()
: hasFocus()
? mFocusBgColor.get()
: mWriteableBgColor.get();
- gl_rect_2d(mTextRect, bg_color, TRUE);
+ gl_rect_2d(mVisibleTextRect, bg_color, TRUE);
}
// draw document view
@@ -1053,9 +1053,9 @@ S32 LLTextBase::getLeftOffset(S32 width)
case LLFontGL::LEFT:
return mHPad;
case LLFontGL::HCENTER:
- return mHPad + (mTextRect.getWidth() - width - mHPad) / 2;
+ return mHPad + (mVisibleTextRect.getWidth() - width - mHPad) / 2;
case LLFontGL::RIGHT:
- return mTextRect.getWidth() - width;
+ return mVisibleTextRect.getWidth() - width;
default:
return mHPad;
}
@@ -1075,13 +1075,13 @@ void LLTextBase::reflow(S32 start_index)
// shrink document to minimum size (visible portion of text widget)
// to force inlined widgets with follows set to shrink
- mDocumentView->setShape(mTextRect);
+ mDocumentView->setShape(mVisibleTextRect);
bool scrolled_to_bottom = mScroller ? mScroller->isAtBottom() : false;
LLRect old_cursor_rect = getLocalRectFromDocIndex(mCursorPos);
- bool follow_selection = mTextRect.overlaps(old_cursor_rect); // cursor is visible
- old_cursor_rect.translate(-mTextRect.mLeft, -mTextRect.mBottom);
+ bool follow_selection = mVisibleTextRect.overlaps(old_cursor_rect); // cursor is visible
+ old_cursor_rect.translate(-mVisibleTextRect.mLeft, -mVisibleTextRect.mBottom);
S32 first_line = getFirstVisibleLine();
@@ -1094,14 +1094,14 @@ void LLTextBase::reflow(S32 start_index)
}
LLRect first_char_rect = getLocalRectFromDocIndex(mScrollIndex);
// subtract off effect of horizontal scrollbar from local position of first char
- first_char_rect.translate(-mTextRect.mLeft, -mTextRect.mBottom);
+ first_char_rect.translate(-mVisibleTextRect.mLeft, -mVisibleTextRect.mBottom);
S32 cur_top = 0;
segment_set_t::iterator seg_iter = mSegments.begin();
S32 seg_offset = 0;
S32 line_start_index = 0;
- const S32 text_available_width = mTextRect.getWidth() - mHPad; // reserve room for margin
+ const S32 text_available_width = mVisibleTextRect.getWidth() - mHPad; // reserve room for margin
S32 remaining_pixels = text_available_width;
LLWString text(getWText());
S32 line_count = 0;
@@ -1239,10 +1239,10 @@ void LLTextBase::reflow(S32 start_index)
}
}
-LLRect LLTextBase::getContentsRect()
+LLRect LLTextBase::getTextBoundingRect()
{
reflow();
- return mContentsRect;
+ return mTextBoundingRect;
}
@@ -1761,7 +1761,7 @@ S32 LLTextBase::getDocIndexFromLocalCoord( S32 local_x, S32 local_y, BOOL round
LLRect visible_region = getVisibleDocumentRect();
// binary search for line that starts before local_y
- line_list_t::const_iterator line_iter = std::lower_bound(mLineInfoList.begin(), mLineInfoList.end(), local_y - mTextRect.mBottom + visible_region.mBottom, compare_bottom());
+ line_list_t::const_iterator line_iter = std::lower_bound(mLineInfoList.begin(), mLineInfoList.end(), local_y - mVisibleTextRect.mBottom + visible_region.mBottom, compare_bottom());
if (line_iter == mLineInfoList.end())
{
@@ -1769,7 +1769,7 @@ S32 LLTextBase::getDocIndexFromLocalCoord( S32 local_x, S32 local_y, BOOL round
}
S32 pos = getLength();
- S32 start_x = mTextRect.mLeft + line_iter->mRect.mLeft;
+ S32 start_x = mVisibleTextRect.mLeft + line_iter->mRect.mLeft;
segment_set_t::iterator line_seg_iter;
S32 line_seg_offset;
@@ -1880,7 +1880,7 @@ LLRect LLTextBase::getLocalRectFromDocIndex(S32 pos) const
if (mLineInfoList.empty())
{
// return default height rect in upper left
- local_rect = mTextRect;
+ local_rect = mVisibleTextRect;
local_rect.mBottom = local_rect.mTop - (S32)(mDefaultFont->getLineHeight());
return local_rect;
}
@@ -1891,8 +1891,8 @@ LLRect LLTextBase::getLocalRectFromDocIndex(S32 pos) const
// compensate for scrolled, inset view of doc
LLRect scrolled_view_rect = getVisibleDocumentRect();
local_rect = doc_rect;
- local_rect.translate(mTextRect.mLeft - scrolled_view_rect.mLeft,
- mTextRect.mBottom - scrolled_view_rect.mBottom);
+ local_rect.translate(mVisibleTextRect.mLeft - scrolled_view_rect.mLeft,
+ mVisibleTextRect.mBottom - scrolled_view_rect.mBottom);
return local_rect;
}
@@ -1992,7 +1992,7 @@ void LLTextBase::changeLine( S32 delta )
LLRect visible_region = getVisibleDocumentRect();
- S32 new_cursor_pos = getDocIndexFromLocalCoord(mDesiredXPixel, mLineInfoList[new_line].mRect.mBottom + mTextRect.mBottom - visible_region.mBottom, TRUE);
+ S32 new_cursor_pos = getDocIndexFromLocalCoord(mDesiredXPixel, mLineInfoList[new_line].mRect.mBottom + mVisibleTextRect.mBottom - visible_region.mBottom, TRUE);
setCursorPos(new_cursor_pos, true);
}
@@ -2068,64 +2068,64 @@ void LLTextBase::updateRects()
{
if (mLineInfoList.empty())
{
- mContentsRect = LLRect(0, mVPad, mHPad, 0);
+ mTextBoundingRect = LLRect(0, mVPad, mHPad, 0);
}
else
{
- mContentsRect = mLineInfoList.begin()->mRect;
+ mTextBoundingRect = mLineInfoList.begin()->mRect;
for (line_list_t::const_iterator line_iter = ++mLineInfoList.begin();
line_iter != mLineInfoList.end();
++line_iter)
{
- mContentsRect.unionWith(line_iter->mRect);
+ mTextBoundingRect.unionWith(line_iter->mRect);
}
- mContentsRect.mTop += mVPad;
+ mTextBoundingRect.mTop += mVPad;
// subtract a pixel off the bottom to deal with rounding errors in measuring font height
- mContentsRect.mBottom -= 1;
+ mTextBoundingRect.mBottom -= 1;
- S32 delta_pos = -mContentsRect.mBottom;
+ S32 delta_pos = -mTextBoundingRect.mBottom;
// move line segments to fit new document rect
for (line_list_t::iterator it = mLineInfoList.begin(); it != mLineInfoList.end(); ++it)
{
it->mRect.translate(0, delta_pos);
}
- mContentsRect.translate(0, delta_pos);
+ mTextBoundingRect.translate(0, delta_pos);
}
// update document container dimensions according to text contents
- LLRect doc_rect = mContentsRect;
- // use old mTextRect constraint document to width of viewable region
+ LLRect doc_rect = mTextBoundingRect;
+ // use old mVisibleTextRect constraint document to width of viewable region
doc_rect.mLeft = 0;
// allow horizontal scrolling?
// if so, use entire width of text contents (sans scrollbars)
- // otherwise, stop at width of mTextRect
+ // otherwise, stop at width of mVisibleTextRect
doc_rect.mRight = mScroller
- ? llmax(mScroller->getRect().mRight - mScroller->getBorderWidth(), mContentsRect.mRight)
- : mTextRect.getWidth();
+ ? llmax(mScroller->getRect().mRight - mScroller->getBorderWidth(), mTextBoundingRect.mRight)
+ : mVisibleTextRect.getWidth();
mDocumentView->setShape(doc_rect);
- //update mTextRect *after* mDocumentView has been resized
+ //update mVisibleTextRect *after* mDocumentView has been resized
// so that scrollbars are added if document needs to scroll
- // since mTextRect does not include scrollbars
- LLRect old_text_rect = mTextRect;
- mTextRect = mScroller ? mScroller->getContentWindowRect() : getLocalRect();
+ // since mVisibleTextRect does not include scrollbars
+ LLRect old_text_rect = mVisibleTextRect;
+ mVisibleTextRect = mScroller ? mScroller->getContentWindowRect() : getLocalRect();
//FIXME: replace border with image?
if (mBorderVisible)
{
- mTextRect.stretch(-1);
+ mVisibleTextRect.stretch(-1);
}
- if (mTextRect != old_text_rect)
+ if (mVisibleTextRect != old_text_rect)
{
needsReflow();
}
- // update document container again, using new mTextRect (that has scrollbars enabled as needed)
+ // update document container again, using new mVisibleTextRect (that has scrollbars enabled as needed)
doc_rect.mRight = mScroller
- ? llmax(mTextRect.getWidth(), mContentsRect.mRight)
- : mTextRect.getWidth();
+ ? llmax(mVisibleTextRect.getWidth(), mTextBoundingRect.mRight)
+ : mVisibleTextRect.getWidth();
mDocumentView->setShape(doc_rect);
}
@@ -2163,7 +2163,7 @@ LLRect LLTextBase::getVisibleDocumentRect() const
LLRect doc_rect = mDocumentView->getLocalRect();
doc_rect.mLeft -= mDocumentView->getRect().mLeft;
// adjust for height of text above widget baseline
- doc_rect.mBottom = doc_rect.getHeight() - mTextRect.getHeight();
+ doc_rect.mBottom = doc_rect.getHeight() - mVisibleTextRect.getHeight();
return doc_rect;
}
}
diff --git a/indra/llui/lltextbase.h b/indra/llui/lltextbase.h
index 0138ca3704..a1f8ba39ae 100644
--- a/indra/llui/lltextbase.h
+++ b/indra/llui/lltextbase.h
@@ -156,8 +156,8 @@ public:
void addDocumentChild(LLView* view);
void removeDocumentChild(LLView* view);
const LLView* getDocumentView() const { return mDocumentView; }
- LLRect getTextRect() { return mTextRect; }
- LLRect getContentsRect();
+ LLRect getVisibleTextRect() { return mVisibleTextRect; }
+ LLRect getTextBoundingRect();
LLRect getVisibleDocumentRect() const;
S32 getVPad() { return mVPad; }
@@ -311,8 +311,8 @@ protected:
// text segmentation and flow
segment_set_t mSegments;
line_list_t mLineInfoList;
- LLRect mTextRect; // The rect in which text is drawn. Excludes borders.
- LLRect mContentsRect;
+ LLRect mVisibleTextRect; // The rect in which text is drawn. Excludes borders.
+ LLRect mTextBoundingRect;
// colors
LLUIColor mCursorColor;
diff --git a/indra/llui/lltextbox.cpp b/indra/llui/lltextbox.cpp
index 0bd0ab59fb..a1f5b5726b 100644
--- a/indra/llui/lltextbox.cpp
+++ b/indra/llui/lltextbox.cpp
@@ -134,12 +134,12 @@ void LLTextBox::setClickedCallback( boost::function<void (void*)> cb, void* user
S32 LLTextBox::getTextPixelWidth()
{
- return getContentsRect().getWidth();
+ return getTextBoundingRect().getWidth();
}
S32 LLTextBox::getTextPixelHeight()
{
- return getContentsRect().getHeight();
+ return getTextBoundingRect().getHeight();
}
diff --git a/indra/llui/lltexteditor.cpp b/indra/llui/lltexteditor.cpp
index faf9ccbeb8..e8fc9475a5 100644
--- a/indra/llui/lltexteditor.cpp
+++ b/indra/llui/lltexteditor.cpp
@@ -758,8 +758,8 @@ BOOL LLTextEditor::handleHover(S32 x, S32 y, MASK mask)
{
mScroller->autoScroll(x, y);
}
- S32 clamped_x = llclamp(x, mTextRect.mLeft, mTextRect.mRight);
- S32 clamped_y = llclamp(y, mTextRect.mBottom, mTextRect.mTop);
+ S32 clamped_x = llclamp(x, mVisibleTextRect.mLeft, mVisibleTextRect.mRight);
+ S32 clamped_y = llclamp(y, mVisibleTextRect.mBottom, mVisibleTextRect.mTop);
setCursorAtLocalPos( clamped_x, clamped_y, true );
mSelectionEnd = mCursorPos;
}
@@ -809,8 +809,8 @@ BOOL LLTextEditor::handleMouseUp(S32 x, S32 y, MASK mask)
{
mScroller->autoScroll(x, y);
}
- S32 clamped_x = llclamp(x, mTextRect.mLeft, mTextRect.mRight);
- S32 clamped_y = llclamp(y, mTextRect.mBottom, mTextRect.mTop);
+ S32 clamped_x = llclamp(x, mVisibleTextRect.mLeft, mVisibleTextRect.mRight);
+ S32 clamped_y = llclamp(y, mVisibleTextRect.mBottom, mVisibleTextRect.mTop);
setCursorAtLocalPos( clamped_x, clamped_y, true );
endSelection();
}
@@ -2075,8 +2075,8 @@ void LLTextEditor::drawPreeditMarker()
const S32 line_height = llround( mDefaultFont->getLineHeight() );
S32 line_start = getLineStart(cur_line);
- S32 line_y = mTextRect.mTop - line_height;
- while((mTextRect.mBottom <= line_y) && (num_lines > cur_line))
+ S32 line_y = mVisibleTextRect.mTop - line_height;
+ while((mVisibleTextRect.mBottom <= line_y) && (num_lines > cur_line))
{
S32 next_start = -1;
S32 line_end = text_len;
@@ -2108,12 +2108,12 @@ void LLTextEditor::drawPreeditMarker()
continue;
}
- S32 preedit_left = mTextRect.mLeft;
+ S32 preedit_left = mVisibleTextRect.mLeft;
if (left > line_start)
{
preedit_left += mDefaultFont->getWidth(text, line_start, left - line_start);
}
- S32 preedit_right = mTextRect.mLeft;
+ S32 preedit_right = mVisibleTextRect.mLeft;
if (right < line_end)
{
preedit_right += mDefaultFont->getWidth(text, line_start, right - line_start);
@@ -2154,7 +2154,7 @@ void LLTextEditor::drawLineNumbers()
{
LLGLSUIDefault gls_ui;
LLRect scrolled_view_rect = getVisibleDocumentRect();
- LLRect content_rect = getTextRect();
+ LLRect content_rect = getVisibleTextRect();
LLLocalClipRect clip(content_rect);
S32 first_line = getFirstVisibleLine();
S32 num_lines = getLineCount();
@@ -2180,12 +2180,12 @@ void LLTextEditor::drawLineNumbers()
{
line_info& line = mLineInfoList[cur_line];
- if ((line.mRect.mTop - scrolled_view_rect.mBottom) < mTextRect.mBottom)
+ if ((line.mRect.mTop - scrolled_view_rect.mBottom) < mVisibleTextRect.mBottom)
{
break;
}
- S32 line_bottom = line.mRect.mBottom - scrolled_view_rect.mBottom + mTextRect.mBottom;
+ S32 line_bottom = line.mRect.mBottom - scrolled_view_rect.mBottom + mVisibleTextRect.mBottom;
// draw the line numbers
if(line.mLineNum != last_line_num && line.mRect.mTop <= scrolled_view_rect.mTop)
{
@@ -2216,8 +2216,8 @@ void LLTextEditor::draw()
{
{
// pad clipping rectangle so that cursor can draw at full width
- // when at left edge of mTextRect
- LLRect clip_rect(mTextRect);
+ // when at left edge of mVisibleTextRect
+ LLRect clip_rect(mVisibleTextRect);
clip_rect.stretch(1);
LLLocalClipRect clip(clip_rect);
drawPreeditMarker();
@@ -2781,7 +2781,7 @@ BOOL LLTextEditor::getPreeditLocation(S32 query_offset, LLCoordGL *coord, LLRect
if (control)
{
LLRect control_rect_screen;
- localRectToScreen(mTextRect, &control_rect_screen);
+ localRectToScreen(mVisibleTextRect, &control_rect_screen);
LLUI::screenRectToGL(control_rect_screen, control);
}
@@ -2832,8 +2832,8 @@ BOOL LLTextEditor::getPreeditLocation(S32 query_offset, LLCoordGL *coord, LLRect
if (coord)
{
- const S32 query_x = mTextRect.mLeft + mDefaultFont->getWidth(text, current_line_start, query - current_line_start);
- const S32 query_y = mTextRect.mTop - (current_line - first_visible_line) * line_height - line_height / 2;
+ const S32 query_x = mVisibleTextRect.mLeft + mDefaultFont->getWidth(text, current_line_start, query - current_line_start);
+ const S32 query_y = mVisibleTextRect.mTop - (current_line - first_visible_line) * line_height - line_height / 2;
S32 query_screen_x, query_screen_y;
localPointToScreen(query_x, query_y, &query_screen_x, &query_screen_y);
LLUI::screenPointToGL(query_screen_x, query_screen_y, &coord->mX, &coord->mY);
@@ -2841,13 +2841,13 @@ BOOL LLTextEditor::getPreeditLocation(S32 query_offset, LLCoordGL *coord, LLRect
if (bounds)
{
- S32 preedit_left = mTextRect.mLeft;
+ S32 preedit_left = mVisibleTextRect.mLeft;
if (preedit_left_position > current_line_start)
{
preedit_left += mDefaultFont->getWidth(text, current_line_start, preedit_left_position - current_line_start);
}
- S32 preedit_right = mTextRect.mLeft;
+ S32 preedit_right = mVisibleTextRect.mLeft;
if (preedit_right_position < current_line_end)
{
preedit_right += mDefaultFont->getWidth(text, current_line_start, preedit_right_position - current_line_start);
@@ -2857,7 +2857,7 @@ BOOL LLTextEditor::getPreeditLocation(S32 query_offset, LLCoordGL *coord, LLRect
preedit_right += mDefaultFont->getWidth(text, current_line_start, current_line_end - current_line_start);
}
- const S32 preedit_top = mTextRect.mTop - (current_line - first_visible_line) * line_height;
+ const S32 preedit_top = mVisibleTextRect.mTop - (current_line - first_visible_line) * line_height;
const S32 preedit_bottom = preedit_top - line_height;
const LLRect preedit_rect_local(preedit_left, preedit_top, preedit_right, preedit_bottom);
diff --git a/indra/newview/llchathistory.cpp b/indra/newview/llchathistory.cpp
index efe9ea4c35..6c843e1ec3 100644
--- a/indra/newview/llchathistory.cpp
+++ b/indra/newview/llchathistory.cpp
@@ -332,12 +332,12 @@ LLChatHistory::~LLChatHistory()
{
static LLUICachedControl<S32> texteditor_border ("UITextEditorBorder", 0);
- LLRect old_text_rect = mTextRect;
- mTextRect = mScroller->getContentWindowRect();
- mTextRect.stretch(-texteditor_border);
- mTextRect.mLeft += mLeftTextPad;
- mTextRect.mRight -= mRightTextPad;
- if (mTextRect != old_text_rect)
+ LLRect old_text_rect = mVisibleTextRect;
+ mVisibleTextRect = mScroller->getContentWindowRect();
+ mVisibleTextRect.stretch(-texteditor_border);
+ mVisibleTextRect.mLeft += mLeftTextPad;
+ mVisibleTextRect.mRight -= mRightTextPad;
+ if (mVisibleTextRect != old_text_rect)
{
needsReflow();
}
diff --git a/indra/newview/lltoastpanel.cpp b/indra/newview/lltoastpanel.cpp
index afb9e261b0..755e647777 100644
--- a/indra/newview/lltoastpanel.cpp
+++ b/indra/newview/lltoastpanel.cpp
@@ -80,7 +80,7 @@ void LLToastPanel::snapToMessageHeight(LLTextBase* message, S32 maxLineCount)
//Knowing the height is set to max allowed, getTextPixelHeight returns needed text height
//Perhaps we need to pass maxLineCount as parameter to getTextPixelHeight to avoid previous reshape.
- S32 requiredTextHeight = message->getContentsRect().getHeight();
+ S32 requiredTextHeight = message->getTextBoundingRect().getHeight();
S32 newTextHeight = llmin(requiredTextHeight, maxTextHeight);
//Calculate last delta height deducting previous heightDelta