summaryrefslogtreecommitdiff
path: root/indra/newview/llnearbychathandler.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview/llnearbychathandler.cpp')
-rw-r--r--indra/newview/llnearbychathandler.cpp84
1 files changed, 38 insertions, 46 deletions
diff --git a/indra/newview/llnearbychathandler.cpp b/indra/newview/llnearbychathandler.cpp
index 957b6d5f94..330a21ef65 100644
--- a/indra/newview/llnearbychathandler.cpp
+++ b/indra/newview/llnearbychathandler.cpp
@@ -29,7 +29,6 @@
#include "llagentdata.h" // for gAgentID
#include "llnearbychathandler.h"
-#include "llbottomtray.h"
#include "llchatitemscontainerctrl.h"
#include "llfirstuse.h"
#include "llfloaterscriptdebug.h"
@@ -41,6 +40,9 @@
#include "llfloaterreg.h"//for LLFloaterReg::getTypedInstance
#include "llviewerwindow.h"//for screen channel position
+#include "llnearbychatbar.h"
+#include "llrootview.h"
+#include "lllayoutstack.h"
//add LLNearbyChatHandler to LLNotificationsUI namespace
using namespace LLNotificationsUI;
@@ -61,7 +63,7 @@ public:
typedef std::vector<LLHandle<LLToast> > toast_vec_t;
typedef std::list<LLHandle<LLToast> > toast_list_t;
- LLNearbyChatScreenChannel(const LLUUID& id):LLScreenChannelBase(id)
+ LLNearbyChatScreenChannel(const Params& p):LLScreenChannelBase(p)
{
mStopProcessing = false;
@@ -80,7 +82,6 @@ public:
void addNotification (LLSD& notification);
void arrangeToasts ();
- void showToastsBottom ();
typedef boost::function<LLToastPanelBase* (void )> create_toast_panel_callback_t;
void setCreatePanelCallback(create_toast_panel_callback_t value) { m_create_toast_panel_callback_t = value;}
@@ -88,8 +89,6 @@ public:
void onToastDestroyed (LLToast* toast, bool app_quitting);
void onToastFade (LLToast* toast);
- void reshape (S32 width, S32 height, BOOL called_from_parent);
-
void redrawToasts()
{
arrangeToasts();
@@ -149,6 +148,7 @@ protected:
toast_list_t m_toast_pool;
bool mStopProcessing;
+ bool mChannelRect;
};
//-----------------------------------------------------------------------------------------------
@@ -351,27 +351,6 @@ void LLNearbyChatScreenChannel::addNotification(LLSD& notification)
arrangeToasts();
}
-void LLNearbyChatScreenChannel::arrangeToasts()
-{
- if(!isHovering())
- {
- showToastsBottom();
- }
-
- if (m_active_toasts.empty())
- {
- LLHints::registerHintTarget("incoming_chat", LLHandle<LLView>());
- }
- else
- {
- LLToast* toast = m_active_toasts.front().get();
- if (toast)
- {
- LLHints::registerHintTarget("incoming_chat", m_active_toasts.front().get()->LLView::getHandle());
- }
- }
-}
-
static bool sort_toasts_predicate(LLHandle<LLToast> first, LLHandle<LLToast> second)
{
if (!first.get() || !second.get()) return false; // STORM-1352
@@ -381,16 +360,31 @@ static bool sort_toasts_predicate(LLHandle<LLToast> first, LLHandle<LLToast> sec
return v1 > v2;
}
-void LLNearbyChatScreenChannel::showToastsBottom()
+void LLNearbyChatScreenChannel::arrangeToasts()
{
- if(mStopProcessing)
+ if(mStopProcessing || isHovering())
return;
+ LLView* floater_snap_region = gViewerWindow->getRootView()->getChildView("floater_snap_region");
+
+ if (!getParent())
+ {
+ // connect to floater snap region just to get resize events, we don't care about being a proper widget
+ floater_snap_region->addChild(this);
+ setFollows(FOLLOWS_ALL);
+ }
+
LLRect toast_rect;
- updateBottom();
- S32 channel_bottom = getRect().mBottom;
+ updateRect();
+
+ LLRect channel_rect;
+ floater_snap_region->localRectToOtherView(floater_snap_region->getLocalRect(), &channel_rect, gFloaterView);
+ channel_rect.mLeft += 10;
+ channel_rect.mRight = channel_rect.mLeft + 300;
+
+ S32 channel_bottom = channel_rect.mBottom;
- S32 bottom = channel_bottom;
+ S32 bottom = channel_bottom + 10;
S32 margin = gSavedSettings.getS32("ToastGap");
//sort active toasts
@@ -409,7 +403,7 @@ void LLNearbyChatScreenChannel::showToastsBottom()
S32 toast_top = bottom + toast->getRect().getHeight() + margin;
- if(toast_top > gFloaterView->getRect().getHeight())
+ if(toast_top > channel_rect.getHeight())
{
while(it!=m_active_toasts.end())
{
@@ -420,7 +414,7 @@ void LLNearbyChatScreenChannel::showToastsBottom()
}
toast_rect = toast->getRect();
- toast_rect.setLeftTopAndSize(getRect().mLeft , bottom + toast_rect.getHeight(), toast_rect.getWidth() ,toast_rect.getHeight());
+ toast_rect.setLeftTopAndSize(channel_rect.mLeft , bottom + toast_rect.getHeight(), toast_rect.getWidth() ,toast_rect.getHeight());
toast->setRect(toast_rect);
bottom += toast_rect.getHeight() - toast->getTopPad() + margin;
@@ -438,15 +432,10 @@ void LLNearbyChatScreenChannel::showToastsBottom()
}
}
- }
-
-void LLNearbyChatScreenChannel::reshape (S32 width, S32 height, BOOL called_from_parent)
-{
- LLScreenChannelBase::reshape(width, height, called_from_parent);
- arrangeToasts();
}
+
//-----------------------------------------------------------------------------------------------
//LLNearbyChatHandler
//-----------------------------------------------------------------------------------------------
@@ -457,7 +446,9 @@ LLNearbyChatHandler::LLNearbyChatHandler(e_notification_type type, const LLSD& i
mType = type;
// Getting a Channel for our notifications
- LLNearbyChatScreenChannel* channel = new LLNearbyChatScreenChannel(LLUUID(gSavedSettings.getString("NearByChatChannelUUID")));
+ LLNearbyChatScreenChannel::Params p;
+ p.id = LLUUID(gSavedSettings.getString("NearByChatChannelUUID"));
+ LLNearbyChatScreenChannel* channel = new LLNearbyChatScreenChannel(p);
LLNearbyChatScreenChannel::create_toast_panel_callback_t callback = createToastPanel;
@@ -473,10 +464,8 @@ LLNearbyChatHandler::~LLNearbyChatHandler()
void LLNearbyChatHandler::initChannel()
{
- LLNearbyChat* nearby_chat = LLFloaterReg::getTypedInstance<LLNearbyChat>("nearby_chat", LLSD());
- LLView* chat_box = LLBottomTray::getInstance()->getChildView("chat_box");
- S32 channel_right_bound = nearby_chat->getRect().mRight;
- mChannel->init(chat_box->getRect().mLeft, channel_right_bound);
+ //LLRect snap_rect = gFloaterView->getSnapRect();
+ //mChannel->init(snap_rect.mLeft, snap_rect.mLeft + 200);
}
@@ -502,7 +491,10 @@ void LLNearbyChatHandler::processChat(const LLChat& chat_msg, // WARNING - not
tmp_chat.mText = tmp_chat.mText.substr(3);
}
- LLNearbyChat* nearby_chat = LLFloaterReg::getTypedInstance<LLNearbyChat>("nearby_chat", LLSD());
+ LLFloater* chat_bar = LLFloaterReg::getInstance("chat_bar");
+
+ LLNearbyChat* nearby_chat = chat_bar->findChild<LLNearbyChat>("nearby_chat");
+
{
//sometimes its usefull to have no name at all...
//if(tmp_chat.mFromName.empty() && tmp_chat.mFromID!= LLUUID::null)
@@ -576,7 +568,7 @@ void LLNearbyChatHandler::processChat(const LLChat& chat_msg, // WARNING - not
sChatWatcher->post(notification);
- if( nearby_chat->getVisible()
+ if( chat_bar->getVisible() && nearby_chat->getVisible()
|| ( chat_msg.mSourceType == CHAT_SOURCE_AGENT
&& gSavedSettings.getBOOL("UseChatBubbles") )
|| !mChannel->getShowToasts() ) // to prevent toasts in Busy mode