diff options
Diffstat (limited to 'indra/newview/llchathistory.cpp')
-rw-r--r-- | indra/newview/llchathistory.cpp | 87 |
1 files changed, 81 insertions, 6 deletions
diff --git a/indra/newview/llchathistory.cpp b/indra/newview/llchathistory.cpp index 581c210bd5..1dc0e8c0a7 100644 --- a/indra/newview/llchathistory.cpp +++ b/indra/newview/llchathistory.cpp @@ -53,8 +53,11 @@ #include "llagent.h" #include "llnotificationsutil.h" #include "lltoastnotifypanel.h" +#include "lltooltip.h" #include "llviewerregion.h" +#include "llviewertexteditor.h" #include "llworld.h" +#include "lluiconstants.h" #include "llsidetray.h"//for blocked objects panel @@ -110,6 +113,34 @@ public: return LLPanel::handleMouseUp(x,y,mask); } + //*TODO remake it using mouse enter/leave and static LLHandle<LLIconCtrl> to add/remove as a child + BOOL handleToolTip(S32 x, S32 y, MASK mask) + { + LLViewerTextEditor* name = getChild<LLViewerTextEditor>("user_name"); + if (name && name->parentPointInView(x, y) && mAvatarID.notNull() && SYSTEM_FROM != mFrom) + { + + // Spawn at right side of the name textbox. + LLRect sticky_rect = name->calcScreenRect(); + S32 icon_x = llmin(sticky_rect.mLeft + name->getTextBoundingRect().getWidth() + 7, sticky_rect.mRight - 3); + + LLToolTip::Params params; + params.background_visible(false); + params.click_callback(boost::bind(&LLChatHistoryHeader::onHeaderPanelClick, this, 0, 0, 0)); + params.delay_time(0.0f); // spawn instantly on hover + params.image(LLUI::getUIImage("Info_Small")); + params.message(""); + params.padding(0); + params.pos(LLCoordGL(icon_x, sticky_rect.mTop - 2)); + params.sticky_rect(sticky_rect); + + LLToolTipMgr::getInstance()->show(params); + return TRUE; + } + + return LLPanel::handleToolTip(x, y, mask); + } + void onObjectIconContextMenuItemClicked(const LLSD& userdata) { std::string level = userdata.asString(); @@ -579,19 +610,26 @@ void LLChatHistory::appendMessage(const LLChat& chat, const LLSD &args, const LL url += "?name=" + chat.mFromName; url += "&owner=" + args["owner_id"].asString(); - LLViewerRegion *region = LLWorld::getInstance()->getRegionFromPosAgent(chat.mPosAgent); - if (region) + std::string slurl = args["slurl"].asString(); + if (slurl.empty()) { - S32 x, y, z; - LLSLURL::globalPosToXYZ(LLVector3d(chat.mPosAgent), x, y, z); - url += "&slurl=" + region->getName() + llformat("/%d/%d/%d", x, y, z); + LLViewerRegion *region = LLWorld::getInstance()->getRegionFromPosAgent(chat.mPosAgent); + if (region) + { + S32 x, y, z; + LLSLURL::globalPosToXYZ(LLVector3d(chat.mPosAgent), x, y, z); + slurl = region->getName() + llformat("/%d/%d/%d", x, y, z); + } } + url += "&slurl=" + slurl; // set the link for the object name to be the objectim SLapp + // (don't let object names with hyperlinks override our objectim Url) LLStyle::Params link_params(style_params); link_params.color.control = "HTMLLinkColor"; link_params.link_href = url; - mEditor->appendText(chat.mFromName + delimiter, false, link_params); + mEditor->appendText("<nolink>" + chat.mFromName + "</nolink>" + delimiter, + false, link_params); } else if ( chat.mFromName != SYSTEM_FROM && chat.mFromID.notNull() ) { @@ -664,8 +702,36 @@ void LLChatHistory::appendMessage(const LLChat& chat, const LLSD &args, const LL { LLToastNotifyPanel* notify_box = new LLToastNotifyPanel( notification); + //we can't set follows in xml since it broke toasts behavior notify_box->setFollowsLeft(); notify_box->setFollowsRight(); + notify_box->setFollowsTop(); + + LLButton* accept_button = notify_box->getChild<LLButton> ("Accept", + TRUE); + if (accept_button != NULL) + { + accept_button->setFollowsNone(); + accept_button->setOrigin(2*HPAD, accept_button->getRect().mBottom); + } + + LLButton* decline_button = notify_box->getChild<LLButton> ( + "Decline", TRUE); + if (accept_button != NULL && decline_button != NULL) + { + decline_button->setFollowsNone(); + decline_button->setOrigin(4*HPAD + + accept_button->getRect().getWidth(), + decline_button->getRect().mBottom); + } + + LLTextEditor* text_editor = notify_box->getChild<LLTextEditor>("text_editor_box", TRUE); + S32 text_heigth = 0; + if(text_editor != NULL) + { + text_heigth = text_editor->getTextBoundingRect().getHeight(); + } + //Prepare the rect for the view LLRect target_rect = mEditor->getDocumentView()->getRect(); // squeeze down the widget by subtracting padding off left and right @@ -675,6 +741,15 @@ void LLChatHistory::appendMessage(const LLChat& chat, const LLSD &args, const LL notify_box->getRect().getHeight()); notify_box->setOrigin(target_rect.mLeft, notify_box->getRect().mBottom); + if (text_editor != NULL) + { + S32 text_heigth_delta = + text_editor->getTextBoundingRect().getHeight() + - text_heigth; + notify_box->reshape(target_rect.getWidth(), + notify_box->getRect().getHeight() + text_heigth_delta); + } + LLInlineViewSegment::Params params; params.view = notify_box; params.left_pad = mLeftWidgetPad; |