diff options
author | Andrew Polunin <apolunin@productengine.com> | 2009-12-18 15:47:21 +0200 |
---|---|---|
committer | Andrew Polunin <apolunin@productengine.com> | 2009-12-18 15:47:21 +0200 |
commit | 55ff23cdad73882fdbf0a4959c1ca8fbf6ada315 (patch) | |
tree | 32309d9d03fca9d79bc83e0b8d289e9170eb83b2 | |
parent | bde0540ab5cea7ad4941a847094e0f8f0ff3e723 (diff) |
implemented major task EXT-3469 Make timestamp disappear instead of covering avatar name while IM floater is being resized
--HG--
branch : product-engine
-rw-r--r-- | indra/newview/llchathistory.cpp | 37 |
1 files changed, 36 insertions, 1 deletions
diff --git a/indra/newview/llchathistory.cpp b/indra/newview/llchathistory.cpp index ee60df1b4b..fc8dc0ff8f 100644 --- a/indra/newview/llchathistory.cpp +++ b/indra/newview/llchathistory.cpp @@ -202,6 +202,8 @@ public: userName->setValue(SL); } + mMinUserNameWidth = style_params.font.getValueFromBlock()->getWidth(userName->getWText().c_str()) + PADDING; + setTimeField(chat); LLAvatarIconCtrl* icon = getChild<LLAvatarIconCtrl>("avatar_icon"); @@ -218,7 +220,37 @@ public: icon->setValue(LLSD("SL_Logo")); } - } + } + + /*virtual*/ void draw() + { + LLTextEditor* user_name = getChild<LLTextEditor>("user_name"); + LLTextBox* time_box = getChild<LLTextBox>("time_box"); + + LLRect user_name_rect = user_name->getRect(); + S32 user_name_width = user_name_rect.getWidth(); + S32 time_box_width = time_box->getRect().getWidth(); + + if (time_box->getVisible() && user_name_width <= mMinUserNameWidth) + { + time_box->setVisible(FALSE); + + user_name_rect.mRight += time_box_width; + user_name->reshape(user_name_rect.getWidth(), user_name_rect.getHeight()); + user_name->setRect(user_name_rect); + } + + if (!time_box->getVisible() && user_name_width > mMinUserNameWidth + time_box_width) + { + user_name_rect.mRight -= time_box_width; + user_name->reshape(user_name_rect.getWidth(), user_name_rect.getHeight()); + user_name->setRect(user_name_rect); + + time_box->setVisible(TRUE); + } + + LLPanel::draw(); + } void nameUpdatedCallback(const LLUUID& id,const std::string& first,const std::string& last,BOOL is_group) { @@ -228,6 +260,8 @@ public: mLastName = last; } protected: + static const S32 PADDING = 20; + void showContextMenu(S32 x,S32 y) { if(mSourceType == CHAT_SOURCE_SYSTEM) @@ -307,6 +341,7 @@ protected: std::string mLastName; std::string mFrom; + S32 mMinUserNameWidth; }; |