diff options
Diffstat (limited to 'indra/newview')
-rw-r--r-- | indra/newview/llchathistory.cpp | 2 | ||||
-rw-r--r-- | indra/newview/llexpandabletextbox.cpp | 17 | ||||
-rw-r--r-- | indra/newview/llexpandabletextbox.h | 2 | ||||
-rw-r--r-- | indra/newview/llviewertexteditor.cpp | 12 |
4 files changed, 17 insertions, 16 deletions
diff --git a/indra/newview/llchathistory.cpp b/indra/newview/llchathistory.cpp index 80f3867a80..cc21b636f1 100644 --- a/indra/newview/llchathistory.cpp +++ b/indra/newview/llchathistory.cpp @@ -109,7 +109,7 @@ void LLChatHistory::appendWidgetMessage(const LLUUID& avatar_id, std::string& fr view_text = from + MESSAGE_USERNAME_DATE_SEPARATOR + time; } //Prepare the rect for the view - LLRect target_rect = mScroller->getContentWindowRect(); + LLRect target_rect = getDocumentView()->getRect(); target_rect.mLeft += mLeftWidgetPad; target_rect.mRight -= mRightWidgetPad; view->reshape(target_rect.getWidth(), view->getRect().getHeight()); diff --git a/indra/newview/llexpandabletextbox.cpp b/indra/newview/llexpandabletextbox.cpp index e2d6bcee8f..48b5fc11b7 100644 --- a/indra/newview/llexpandabletextbox.cpp +++ b/indra/newview/llexpandabletextbox.cpp @@ -48,10 +48,11 @@ public: mExpanderLabel(more_text) {} - /*virtual*/ S32 getWidth(S32 first_char, S32 num_chars) const + /*virtual*/ void getDimensions(S32 first_char, S32 num_chars, S32& width, S32& height) const { // more label always spans width of text box - return mEditor.getTextRect().getWidth(); + width = mEditor.getTextRect().getWidth(); + height = llceil(mStyle->getFont()->getLineHeight()); } /*virtual*/ S32 getOffset(S32 segment_local_x_coord, S32 start_offset, S32 num_chars, bool round) const { @@ -85,8 +86,9 @@ public: mEditor.getUseEllipses()); return right_x; } - /*virtual*/ S32 getMaxHeight() const { return llceil(mStyle->getFont()->getLineHeight()); } /*virtual*/ bool canEdit() const { return false; } + // eat handleMouseDown event so we get the mouseup event + /*virtual*/ BOOL handleMouseDown(S32 x, S32 y, MASK mask) { return TRUE; } /*virtual*/ BOOL handleMouseUp(S32 x, S32 y, MASK mask) { mEditor.onCommit(); return TRUE; } /*virtual*/ BOOL handleHover(S32 x, S32 y, MASK mask) { @@ -126,9 +128,12 @@ void LLExpandableTextBox::LLTextBoxEx::reshape(S32 width, S32 height, BOOL calle } } -void LLExpandableTextBox::LLTextBoxEx::setValue(const LLSD& value) +void LLExpandableTextBox::LLTextBoxEx::setText(const LLStringExplicit& text) { - LLTextBox::setValue(value); + // LLTextBox::setText will obliterate the expander segment, so make sure + // we generate it again by clearing mExpanderVisible + mExpanderVisible = false; + LLTextBox::setText(text); // text contents have changed, segments are cleared out // so hide the expander and determine if we need it @@ -395,7 +400,6 @@ void LLExpandableTextBox::onTopLost() void LLExpandableTextBox::setValue(const LLSD& value) { collapseTextBox(); - mText = value.asString(); mTextBox->setValue(value); } @@ -403,7 +407,6 @@ void LLExpandableTextBox::setValue(const LLSD& value) void LLExpandableTextBox::setText(const std::string& str) { collapseTextBox(); - mText = str; mTextBox->setText(str); } diff --git a/indra/newview/llexpandabletextbox.h b/indra/newview/llexpandabletextbox.h index d6401e224f..d45527aabb 100644 --- a/indra/newview/llexpandabletextbox.h +++ b/indra/newview/llexpandabletextbox.h @@ -60,7 +60,7 @@ protected: // adds or removes "More" link as needed /*virtual*/ void reshape(S32 width, S32 height, BOOL called_from_parent = TRUE); - /*virtual*/ void setValue(const LLSD& value); + /*virtual*/ void setText(const LLStringExplicit& text); /** * Returns difference between text box height and text height. diff --git a/indra/newview/llviewertexteditor.cpp b/indra/newview/llviewertexteditor.cpp index 0ce1ecc6ee..65994dfb30 100644 --- a/indra/newview/llviewertexteditor.cpp +++ b/indra/newview/llviewertexteditor.cpp @@ -130,15 +130,17 @@ public: mToolTip = inv_item->getName() + '\n' + inv_item->getDescription(); } - /*virtual*/ S32 getWidth(S32 first_char, S32 num_chars) const + /*virtual*/ void getDimensions(S32 first_char, S32 num_chars, S32& width, S32& height) const { if (num_chars == 0) { - return 0; + width = 0; + height = 0; } else { - return EMBEDDED_ITEM_LABEL_PADDING + mImage->getWidth() + mStyle->getFont()->getWidth(mLabel.c_str()); + width = EMBEDDED_ITEM_LABEL_PADDING + mImage->getWidth() + mStyle->getFont()->getWidth(mLabel.c_str()); + height = llmax(mImage->getHeight(), llceil(mStyle->getFont()->getLineHeight())); } } @@ -169,10 +171,6 @@ public: return right_x; } - /*virtual*/ S32 getMaxHeight() const - { - return llmax(mImage->getHeight(), llceil(mStyle->getFont()->getLineHeight())); - } /*virtual*/ bool canEdit() const { return false; } |