summaryrefslogtreecommitdiff
path: root/indra/newview/llscreenchannel.cpp
diff options
context:
space:
mode:
authorTofu Linden <tofu.linden@lindenlab.com>2010-01-14 13:45:23 -0800
committerTofu Linden <tofu.linden@lindenlab.com>2010-01-14 13:45:23 -0800
commitaf2cbcee129911cb4e1d25fbd710d755c13b0282 (patch)
treea09d45e10d3b03c94256424ecd8f881e75551aae /indra/newview/llscreenchannel.cpp
parent0a955ae550d3b810da67a17848a6cbc5ef11edb5 (diff)
parent23a266521ead539cb3e8c2c76e7ead46847b70ca (diff)
Merge from viewer2, including fix for the test failure biting qarl.
Minor conflict in llviewerfloaterreg.cpp resolved.
Diffstat (limited to 'indra/newview/llscreenchannel.cpp')
-rw-r--r--indra/newview/llscreenchannel.cpp149
1 files changed, 26 insertions, 123 deletions
diff --git a/indra/newview/llscreenchannel.cpp b/indra/newview/llscreenchannel.cpp
index da3f1543dd..027f3daffb 100644
--- a/indra/newview/llscreenchannel.cpp
+++ b/indra/newview/llscreenchannel.cpp
@@ -59,17 +59,14 @@ bool LLScreenChannel::mWasStartUpToastShown = false;
// LLScreenChannelBase
//////////////////////
LLScreenChannelBase::LLScreenChannelBase(const LLUUID& id) :
- mOverflowToastPanel(NULL)
- ,mToastAlignment(NA_BOTTOM)
+ mToastAlignment(NA_BOTTOM)
,mCanStoreToasts(true)
,mHiddenToastsNum(0)
- ,mOverflowToastHidden(false)
,mHoveredToast(NULL)
,mControlHovering(false)
,mShowToasts(true)
{
mID = id;
- mOverflowFormatString = LLTrans::getString("OverflowInfoChannelString");
mWorldViewRectConnection = gViewerWindow->setOnWorldViewRectUpdated(boost::bind(&LLScreenChannelBase::updatePositionAndSize, this, _1, _2));
setMouseOpaque( false );
setVisible(FALSE);
@@ -217,11 +214,6 @@ void LLScreenChannel::addToast(const LLToast::Params& p)
ToastElem new_toast_elem(p);
- // reset HIDDEN flags for the Overflow Toast
- mOverflowToastHidden = false;
- if(mOverflowToastPanel)
- mOverflowToastPanel->setIsHidden(false);
-
new_toast_elem.toast->setOnFadeCallback(boost::bind(&LLScreenChannel::onToastFade, this, _1));
new_toast_elem.toast->setOnToastDestroyedCallback(boost::bind(&LLScreenChannel::onToastDestroyed, this, _1));
if(mControlHovering)
@@ -322,8 +314,6 @@ void LLScreenChannel::loadStoredToastsToChannel()
if(mStoredToastList.size() == 0)
return;
-
- mOverflowToastHidden = false;
for(it = mStoredToastList.begin(); it != mStoredToastList.end(); ++it)
{
@@ -344,8 +334,6 @@ void LLScreenChannel::loadStoredToastByNotificationIDToChannel(LLUUID id)
if( it == mStoredToastList.end() )
return;
- mOverflowToastHidden = false;
-
LLToast* toast = (*it).toast;
if(toast->getVisible())
@@ -357,7 +345,6 @@ void LLScreenChannel::loadStoredToastByNotificationIDToChannel(LLUUID id)
toast->setIsHidden(false);
toast->resetTimer();
mToastList.push_back((*it));
- mStoredToastList.erase(it);
redrawToasts();
}
@@ -491,7 +478,7 @@ void LLScreenChannel::showToastsBottom()
if(floater && floater->overlapsScreenChannel())
{
LLRect world_rect = gViewerWindow->getWorldViewRectScaled();
- if(toast_rect.mTop + getOverflowToastHeight() + toast_margin > world_rect.mTop)
+ if(toast_rect.mTop > world_rect.mTop)
{
break;
}
@@ -527,7 +514,7 @@ void LLScreenChannel::showToastsBottom()
}
}
- if(it != mToastList.rend() && !mOverflowToastHidden)
+ if(it != mToastList.rend())
{
mHiddenToastsNum = 0;
for(; it != mToastList.rend(); it++)
@@ -536,7 +523,6 @@ void LLScreenChannel::showToastsBottom()
(*it).toast->setVisible(FALSE);
mHiddenToastsNum++;
}
- createOverflowToast(bottom, gSavedSettings.getS32("NotificationTipToastLifeTime"));
}
else
{
@@ -567,94 +553,6 @@ void LLScreenChannel::showToastsTop()
}
//--------------------------------------------------------------------------
-void LLScreenChannel::createOverflowToast(S32 bottom, F32 timer)
-{
- LLRect toast_rect;
- LLToast::Params p;
- p.lifetime_secs = timer;
-
- if(!mOverflowToastPanel)
- mOverflowToastPanel = new LLToast(p);
-
- if(!mOverflowToastPanel)
- return;
-
- mOverflowToastPanel->startFading();
- mOverflowToastPanel->setOnFadeCallback(boost::bind(&LLScreenChannel::onOverflowToastHide, this));
-
- LLTextBox* text_box = mOverflowToastPanel->getChild<LLTextBox>("toast_text");
- std::string text = llformat(mOverflowFormatString.c_str(),mHiddenToastsNum);
- if(mHiddenToastsNum == 1)
- {
- text += ".";
- }
- else
- {
- text += "s.";
- }
-
- toast_rect = mOverflowToastPanel->getRect();
- mOverflowToastPanel->reshape(getRect().getWidth(), toast_rect.getHeight(), true);
- toast_rect.setLeftTopAndSize(getRect().mLeft, bottom + toast_rect.getHeight()+gSavedSettings.getS32("ToastGap"), getRect().getWidth(), toast_rect.getHeight());
- mOverflowToastPanel->setRect(toast_rect);
-
- // don't show overflow toast if there is not enough space for it.
- LLDockableFloater* floater = dynamic_cast<LLDockableFloater*>(LLDockableFloater::getInstanceHandle().get());
- if(floater && floater->overlapsScreenChannel())
- {
- LLRect world_rect = gViewerWindow->getWorldViewRectScaled();
- if(toast_rect.mTop > world_rect.mTop)
- {
- closeOverflowToastPanel();
- return;
- }
- }
-
- text_box->setValue(text);
- text_box->setVisible(TRUE);
-
- mOverflowToastPanel->setVisible(TRUE);
-}
-
-//--------------------------------------------------------------------------
-void LLScreenChannel::onOverflowToastHide()
-{
- mOverflowToastHidden = true;
-
- // remove all hidden toasts from channel and save interactive notifications
- for(std::vector<ToastElem>::iterator it = mToastList.begin(); it != mToastList.end();)
- {
- if(!(*it).toast->getVisible())
- {
- if((*it).toast->getCanBeStored())
- {
- storeToast((*it));
- }
- else
- {
- deleteToast((*it).toast);
- }
-
- it = mToastList.erase(it);
- }
- else
- {
- ++it;
- }
- }
-}
-
-//--------------------------------------------------------------------------
-void LLScreenChannel::closeOverflowToastPanel()
-{
- if(mOverflowToastPanel != NULL)
- {
- mOverflowToastPanel->setVisible(FALSE);
- mOverflowToastPanel->stopFading();
- }
-}
-
-//--------------------------------------------------------------------------
void LLScreenChannel::createStartUpToast(S32 notif_num, F32 timer)
{
LLRect toast_rect;
@@ -699,24 +597,6 @@ F32 LLScreenChannel::getHeightRatio()
return ratio;
}
-S32 LLScreenChannel::getOverflowToastHeight()
-{
- if(mOverflowToastPanel)
- {
- return mOverflowToastPanel->getRect().getHeight();
- }
-
- static S32 height = 0;
- if(0 == height)
- {
- LLToast::Params p;
- LLToast* toast = new LLToast(p);
- height = toast->getRect().getHeight();
- delete toast;
- }
- return height;
-}
-
//--------------------------------------------------------------------------
void LLScreenChannel::updateStartUpString(S32 num)
{
@@ -779,6 +659,19 @@ void LLScreenChannel::hideToastsFromScreen()
}
//--------------------------------------------------------------------------
+void LLScreenChannel::hideToast(const LLUUID& notification_id)
+{
+ std::vector<ToastElem>::iterator it = find(mToastList.begin(), mToastList.end(), notification_id);
+ if(mToastList.end() != it)
+ {
+ ToastElem te = *it;
+ te.toast->setVisible(FALSE);
+ te.toast->stopTimer();
+ mToastList.erase(it);
+ }
+}
+
+//--------------------------------------------------------------------------
void LLScreenChannel::removeToastsFromChannel()
{
hideToastsFromScreen();
@@ -896,3 +789,13 @@ void LLScreenChannel::updateShowToastsState()
//--------------------------------------------------------------------------
+LLToast* LLScreenChannel::getToastByNotificationID(LLUUID id)
+{
+ std::vector<ToastElem>::iterator it = find(mStoredToastList.begin(),
+ mStoredToastList.end(), id);
+
+ if (it == mStoredToastList.end())
+ return NULL;
+
+ return it->toast;
+}