diff options
author | Steven Bennetts <steve@lindenlab.com> | 2009-09-29 19:37:05 +0000 |
---|---|---|
committer | Steven Bennetts <steve@lindenlab.com> | 2009-09-29 19:37:05 +0000 |
commit | 606b381c9fbc43c214afd26fb2e2598eec656b66 (patch) | |
tree | 422a6d5d94d50bd97ac5bcbdb52f0f6de083c6e7 /indra/newview/llscreenchannel.cpp | |
parent | 751cc7cf68bb4d766e8ecaaf76af054dcfbbe9dc (diff) |
merge https://svn.aws.productengine.com/secondlife/export-from-ll/viewer-2-0@1830 https://svn.aws.productengine.com/secondlife/pe/stable-2@1839 -> viewer-2.0.0-3
JIRAS:
EXT-96 EXT-204 EXT-312 EXT-334 EXT-479 EXT-498 EXT-514 EXT-637 EXT-647 EXT-746 EXT-748 EXT-749 EXT-757 EXT-789 EXT-794 EXT-808 EXT-817 EXT-823 EXT-831 EXT-834 EXT-837 EXT-844 EXT-848 EXT-862 EXT-876 EXT-896 EXT-897 EXT-898 EXT-899 EXT-910 EXT-912 EXT-918 EXT-921 EXT-925 EXT-926 EXT-928 EXT-930 EXT-931 EXT-935 EXT-938 EXT-939 EXT-952 EXT-985 EXT-986 EXT-992 EXT-994 EXT-995 EXT-996 EXT-997 EXT-998 EXT-1001 EXT-1004 EXT-1010 EXT-1012 EXT-1016 EXT-1018 EXT-1020 EXT-1028 EXT-1041 EXT-1044 EXT-1051 EXT-1052 EXT-1061 EXT-1069 EXT-1071 EXT-1074 EXT-1075 EXT-1076 EXT-1078 EXT-1080 EXT-1081 EXT-1082 EXT-1083 EXT-1085 EXT-1092 EXT-1093 EXT-1099 EXT-1100 EXT-1101 EXT-1104 EXT-1106 EXT-1111 EXT-1113 EXT-1114 EXT-1115 EXT-1116 EXT-1118 EXT-1119 EXT-1129 EXT-1132 EXT-1135 EXT-1138 EXT-1142 EXT-1161 EXT-1162 EXT-1178 EXT-1180
* NEW DEVELOPMENT:
* EXT-898 - Add dock/undock support for camera and movement controls
* Avatar list changes
* Bottom bar changes: menu, docking, visibility
* Camera changes
* Camera & Movement Floaters
* Dockable Floaters (LLDockableFloater)
* Removed LLListCtrl
* Toast / Notification changes: signal / destruction changes, ordering
* Nearby chat input should display active voice indicator
QA NOTES:
* Message Well Window is ready to be tested for regression & matching the spec.
* Verify Group List Item L&F
* Verify All tabs in People Panel
* Verify that Picks behavior is not changed
Diffstat (limited to 'indra/newview/llscreenchannel.cpp')
-rw-r--r-- | indra/newview/llscreenchannel.cpp | 173 |
1 files changed, 133 insertions, 40 deletions
diff --git a/indra/newview/llscreenchannel.cpp b/indra/newview/llscreenchannel.cpp index 2157f1af74..082bba027f 100644 --- a/indra/newview/llscreenchannel.cpp +++ b/indra/newview/llscreenchannel.cpp @@ -39,9 +39,15 @@ #include "lltoastpanel.h" #include "llviewercontrol.h" +#include "llviewerwindow.h" #include "llfloaterreg.h" #include "lltrans.h" +#include "lldockablefloater.h" +#include "llimpanel.h" +#include "llsyswellwindow.h" +#include "llimfloater.h" + #include <algorithm> using namespace LLNotificationsUI; @@ -53,37 +59,52 @@ LLScreenChannel::LLScreenChannel(LLUUID& id): mOverflowToastPanel(NULL), mStartU mToastAlignment(NA_BOTTOM), mCanStoreToasts(true), mHiddenToastsNum(0), mOverflowToastHidden(false), mIsHovering(false), mControlHovering(false), - mShowToasts(false) + mShowToasts(true) { mID = id; - - setFollows(FOLLOWS_RIGHT | FOLLOWS_BOTTOM | FOLLOWS_TOP); - mOverflowFormatString = LLTrans::getString("OverflowInfoChannelString"); - + mWorldViewRectConnection = gViewerWindow->setOnWorldViewRectUpdated(boost::bind(&LLScreenChannel::updatePositionAndSize, this, _1, _2)); setMouseOpaque( false ); + setVisible(FALSE); } //-------------------------------------------------------------------------- void LLScreenChannel::init(S32 channel_left, S32 channel_right) { - S32 channel_top = getRootView()->getRect().getHeight() - gSavedSettings.getS32("NavBarMargin"); - S32 channel_bottom = getRootView()->getRect().mBottom + gSavedSettings.getS32("ChannelBottomPanelMargin"); + S32 channel_top = gViewerWindow->getWorldViewRect().getHeight(); + S32 channel_bottom = gViewerWindow->getWorldViewRect().mBottom + gSavedSettings.getS32("ChannelBottomPanelMargin"); setRect(LLRect(channel_left, channel_top, channel_right, channel_bottom)); - + setVisible(TRUE); } //-------------------------------------------------------------------------- LLScreenChannel::~LLScreenChannel() { + mWorldViewRectConnection.disconnect(); } //-------------------------------------------------------------------------- -void LLScreenChannel::reshape(S32 width, S32 height, BOOL called_from_parent) +void LLScreenChannel::updatePositionAndSize(LLRect old_world_rect, LLRect new_world_rect) { - LLUICtrl::reshape(width, height, called_from_parent); - if(mToastAlignment != NA_CENTRE) - showToasts(); + S32 top_delta = old_world_rect.mTop - new_world_rect.mTop; + S32 right_delta = old_world_rect.mRight - new_world_rect.mRight; + + LLRect this_rect = getRect(); + + this_rect.mTop -= top_delta; + switch(mChannelAlignment) + { + case CA_LEFT : + break; + case CA_CENTRE : + this_rect.setCenterAndSize(new_world_rect.getWidth() / 2, new_world_rect.getHeight() / 2, this_rect.getWidth(), this_rect.getHeight()); + break; + case CA_RIGHT : + this_rect.mLeft -= right_delta; + this_rect.mRight -= right_delta; + } + setRect(this_rect); + redrawToasts(); } //-------------------------------------------------------------------------- @@ -91,12 +112,12 @@ void LLScreenChannel::addToast(LLToast::Params p) { bool store_toast = false, show_toast = false; - show_toast = mShowToasts || p.force_show; + show_toast = mWasStartUpToastShown && (mShowToasts || p.force_show); store_toast = !show_toast && p.can_be_stored && mCanStoreToasts; if(!show_toast && !store_toast) { - mOnRejectToast(p); + mRejectToastSignal(p.notif_id); return; } @@ -104,7 +125,8 @@ void LLScreenChannel::addToast(LLToast::Params p) mOverflowToastHidden = false; - new_toast_elem.toast->setOnFadeCallback(boost::bind(&LLScreenChannel::onToastFade, this, new_toast_elem.toast)); + new_toast_elem.toast->setOnFadeCallback(boost::bind(&LLScreenChannel::onToastFade, this, _1)); + new_toast_elem.toast->setOnToastDestroyedCallback(boost::bind(&LLScreenChannel::onToastDestroyed, this, _1)); if(mControlHovering) { new_toast_elem.toast->setOnToastHoverCallback(boost::bind(&LLScreenChannel::onToastHover, this, _1, _2)); @@ -113,7 +135,7 @@ void LLScreenChannel::addToast(LLToast::Params p) if(show_toast) { mToastList.push_back(new_toast_elem); - showToasts(); + redrawToasts(); } else // store_toast { @@ -123,15 +145,27 @@ void LLScreenChannel::addToast(LLToast::Params p) } //-------------------------------------------------------------------------- +void LLScreenChannel::onToastDestroyed(LLToast* toast) +{ + std::vector<ToastElem>::iterator it = find(mToastList.begin(), mToastList.end(), static_cast<LLPanel*>(toast)); + + if(it != mToastList.end()) + { + mToastList.erase(it); + } +} + + +//-------------------------------------------------------------------------- void LLScreenChannel::onToastFade(LLToast* toast) { std::vector<ToastElem>::iterator it = find(mToastList.begin(), mToastList.end(), static_cast<LLPanel*>(toast)); - bool destroy_toast = !mCanStoreToasts || !toast->getCanBeStored(); - if(destroy_toast) + bool delete_toast = !mCanStoreToasts || !toast->getCanBeStored(); + if(delete_toast) { mToastList.erase(it); - toast->mOnToastDestroy(toast); + deleteToast(toast); } else { @@ -139,7 +173,22 @@ void LLScreenChannel::onToastFade(LLToast* toast) mToastList.erase(it); } - showToasts(); + redrawToasts(); +} + +//-------------------------------------------------------------------------- +void LLScreenChannel::deleteToast(LLToast* toast) +{ + // send signal to observers about destroying of a toast + toast->mOnDeleteToastSignal(toast); + + // update channel's Hovering state + // turning hovering off mannualy because onMouseLeave won't happen if a toast was closed using a keyboard + if(toast->hasFocus()) + setHovering(false); + + // close the toast + toast->closeFloater(); } //-------------------------------------------------------------------------- @@ -173,11 +222,11 @@ void LLScreenChannel::loadStoredToastsToChannel() } mStoredToastList.clear(); - showToasts(); + redrawToasts(); } //-------------------------------------------------------------------------- -void LLScreenChannel::loadStoredToastByIDToChannel(LLUUID id) +void LLScreenChannel::loadStoredToastByNotificationIDToChannel(LLUUID id) { std::vector<ToastElem>::iterator it = find(mStoredToastList.begin(), mStoredToastList.end(), id); @@ -191,11 +240,11 @@ void LLScreenChannel::loadStoredToastByIDToChannel(LLUUID id) mToastList.push_back((*it)); mStoredToastList.erase(it); - showToasts(); + redrawToasts(); } //-------------------------------------------------------------------------- -void LLScreenChannel::removeStoredToastByID(LLUUID id) +void LLScreenChannel::removeStoredToastByNotificationID(LLUUID id) { // *TODO: may be remove this function std::vector<ToastElem>::iterator it = find(mStoredToastList.begin(), mStoredToastList.end(), id); @@ -205,7 +254,7 @@ void LLScreenChannel::removeStoredToastByID(LLUUID id) LLToast* toast = (*it).toast; mStoredToastList.erase(it); - toast->discardNotification(); + mRejectToastSignal(toast->getNotificationID()); } //-------------------------------------------------------------------------- @@ -223,15 +272,15 @@ void LLScreenChannel::killToastByNotificationID(LLUUID id) // NOTE: if a notification is unresponded this function will be called twice for the same toast. // At first, the notification will be discarded, at second (it will be caused by discarding), // the toast will be destroyed. - if(toast->getIsNotificationUnResponded()) + if(toast->isNotificationValid()) { - toast->discardNotification(); + mRejectToastSignal(toast->getNotificationID()); } else { mToastList.erase(it); - toast->mOnToastDestroy(toast); - showToasts(); + deleteToast(toast); + redrawToasts(); } return; } @@ -243,8 +292,9 @@ void LLScreenChannel::killToastByNotificationID(LLUUID id) { LLToast* toast = (*it).toast; mStoredToastList.erase(it); - toast->discardNotification(); - toast->mOnToastDestroy(toast); + // send signal to a listener to let him perform some action on toast rejecting + mRejectToastSignal(toast->getNotificationID()); + deleteToast(toast); } } @@ -261,12 +311,12 @@ void LLScreenChannel::modifyToastByNotificationID(LLUUID id, LLPanel* panel) delete old_panel; toast->insertPanel(panel); toast->resetTimer(); - showToasts(); + redrawToasts(); } } //-------------------------------------------------------------------------- -void LLScreenChannel::showToasts() +void LLScreenChannel::redrawToasts() { if(mToastList.size() == 0 || mIsHovering) return; @@ -487,31 +537,55 @@ void LLScreenChannel::removeToastsFromChannel() hideToastsFromScreen(); for(std::vector<ToastElem>::iterator it = mToastList.begin(); it != mToastList.end(); it++) { - // *TODO: ivestigate mOnToastDestroy callback - change name or/and place - (*it).toast->mOnToastDestroy((*it).toast); + deleteToast((*it).toast); } mToastList.clear(); } //-------------------------------------------------------------------------- -void LLScreenChannel::removeAndStoreAllVisibleToasts() +void LLScreenChannel::removeAndStoreAllStorableToasts() { if(mToastList.size() == 0) return; hideToastsFromScreen(); - for(std::vector<ToastElem>::iterator it = mToastList.begin(); it != mToastList.end(); it++) + for(std::vector<ToastElem>::iterator it = mToastList.begin(); it != mToastList.end();) { if((*it).toast->getCanBeStored()) { mStoredToastList.push_back(*it); mOnStoreToast((*it).toast->getPanel(), (*it).id); (*it).toast->stopTimer(); + it = mToastList.erase(it); } - (*it).toast->setVisible(FALSE); + else + { + ++it; } + } + redrawToasts(); +} - mToastList.clear(); +//-------------------------------------------------------------------------- +void LLScreenChannel::removeToastsBySessionID(LLUUID id) +{ + if(mToastList.size() == 0) + return; + + hideToastsFromScreen(); + for(std::vector<ToastElem>::iterator it = mToastList.begin(); it != mToastList.end();) + { + if((*it).toast->getSessionID() == id) + { + deleteToast((*it).toast); + it = mToastList.erase(it); + } + else + { + ++it; + } + } + redrawToasts(); } //-------------------------------------------------------------------------- @@ -546,11 +620,30 @@ void LLScreenChannel::onToastHover(LLToast* toast, bool mouse_enter) } if(!mIsHovering) - showToasts(); + redrawToasts(); } //-------------------------------------------------------------------------- +void LLScreenChannel::updateShowToastsState() +{ + LLFloater* floater = LLDockableFloater::getInstanceHandle().get(); + if(!floater) + { + setShowToasts(true); + return; + } + if(dynamic_cast<LLIMFloater*>(floater) || dynamic_cast<LLSysWellWindow*>(floater)) + { + setShowToasts(!(floater->getVisible() && floater->isDocked())); + if (!getShowToasts()) + { + removeAndStoreAllStorableToasts(); + } + + } +} +//-------------------------------------------------------------------------- |