diff options
author | Dmitry Zaporozhan <dzaporozhan@productengine.com> | 2009-12-07 19:23:34 +0200 |
---|---|---|
committer | Dmitry Zaporozhan <dzaporozhan@productengine.com> | 2009-12-07 19:23:34 +0200 |
commit | 3dee439c1def1f96e9837eb2f65428e5484f9c8e (patch) | |
tree | 2aac725352781aa12cf425b7c4719e5b53be2823 /indra | |
parent | 20d5fafc1cd1598f38e4ecefc11f4ee891afec21 (diff) |
Implemented normal task EXT-3089 - Notification toasts positioning, layering and stacking.
--HG--
branch : product-engine
Diffstat (limited to 'indra')
-rw-r--r-- | indra/newview/app_settings/settings.xml | 13 | ||||
-rw-r--r-- | indra/newview/llimfloater.cpp | 1 | ||||
-rw-r--r-- | indra/newview/llscreenchannel.cpp | 66 | ||||
-rw-r--r-- | indra/newview/llscreenchannel.h | 2 | ||||
-rw-r--r-- | indra/newview/llsyswellwindow.cpp | 1 |
5 files changed, 67 insertions, 16 deletions
diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index b301d784f9..20d81362fd 100644 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -5028,7 +5028,18 @@ <key>Type</key> <string>S32</string> <key>Value</key> - <integer>35</integer> + <integer>5</integer> + </map> + <key>NotificationChannelHeightRatio</key> + <map> + <key>Comment</key> + <string>TODO</string> + <key>Persist</key> + <integer>1</integer> + <key>Type</key> + <string>F32</string> + <key>Value</key> + <real>0.5</real> </map> <key>OverflowToastHeight</key> <map> diff --git a/indra/newview/llimfloater.cpp b/indra/newview/llimfloater.cpp index 2bc07d0c27..36c40eb49b 100644 --- a/indra/newview/llimfloater.cpp +++ b/indra/newview/llimfloater.cpp @@ -439,6 +439,7 @@ void LLIMFloater::setVisible(BOOL visible) if(channel) { channel->updateShowToastsState(); + channel->redrawToasts(); } if (visible && mChatHistory && mInputEditor) diff --git a/indra/newview/llscreenchannel.cpp b/indra/newview/llscreenchannel.cpp index 4f0c873c61..87752e31f5 100644 --- a/indra/newview/llscreenchannel.cpp +++ b/indra/newview/llscreenchannel.cpp @@ -125,6 +125,8 @@ LLScreenChannelBase(id) void LLScreenChannel::init(S32 channel_left, S32 channel_right) { LLScreenChannelBase::init(channel_left, channel_right); + LLRect world_rect = gViewerWindow->getWorldViewRectScaled(); + updatePositionAndSize(world_rect, world_rect); } //-------------------------------------------------------------------------- @@ -136,7 +138,23 @@ LLScreenChannel::~LLScreenChannel() //-------------------------------------------------------------------------- void LLScreenChannel::updatePositionAndSize(LLRect old_world_rect, LLRect new_world_rect) { - LLScreenChannelBase::updatePositionAndSize(old_world_rect, new_world_rect); + S32 right_delta = old_world_rect.mRight - new_world_rect.mRight; + LLRect this_rect = getRect(); + + this_rect.mTop = new_world_rect.getHeight() * getHeightRatio(); + 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(); } //-------------------------------------------------------------------------- @@ -169,6 +187,7 @@ void LLScreenChannel::addToast(const LLToast::Params& p) if(show_toast) { mToastList.push_back(new_toast_elem); + updateShowToastsState(); redrawToasts(); } else // store_toast @@ -356,6 +375,12 @@ void LLScreenChannel::modifyToastByNotificationID(LLUUID id, LLPanel* panel) } } +void LLScreenChannel::onVisibleChanged(LLUICtrl* ctrl, const LLSD& param) +{ + updateShowToastsState(); + redrawToasts(); +} + //-------------------------------------------------------------------------- void LLScreenChannel::redrawToasts() { @@ -405,10 +430,17 @@ void LLScreenChannel::showToastsBottom() { if( it != mToastList.rend()-1) { - stop_showing_toasts = ((*it).toast->getRect().mTop + gSavedSettings.getS32("OverflowToastHeight") + gSavedSettings.getS32("ToastGap")) > getRect().mTop; + S32 toast_top = (*it).toast->getRect().mTop + gSavedSettings.getS32("ToastGap"); + stop_showing_toasts = toast_top > getRect().mTop; } } + // at least one toast should be visible + if(it == mToastList.rbegin()) + { + stop_showing_toasts = false; + } + if(stop_showing_toasts) break; @@ -566,6 +598,21 @@ void LLScreenChannel::createStartUpToast(S32 notif_num, F32 timer) mStartUpToastPanel->setVisible(TRUE); } +// static -------------------------------------------------------------------------- +F32 LLScreenChannel::getHeightRatio() +{ + F32 ratio = gSavedSettings.getF32("NotificationChannelHeightRatio"); + if(0.0f > ratio) + { + ratio = 0.0f; + } + else if(1.0f < ratio) + { + ratio = 1.0f; + } + return ratio; +} + //-------------------------------------------------------------------------- void LLScreenChannel::updateStartUpString(S32 num) { @@ -735,27 +782,16 @@ void LLScreenChannel::updateShowToastsState() return; } - // for IM floaters showed in a docked state - prohibit showing of ani toast - if(dynamic_cast<LLIMFloater*>(floater) - || dynamic_cast<LLScriptFloater*>(floater) ) - { - setShowToasts(!(floater->getVisible() && floater->isDocked())); - if (!getShowToasts()) - { - removeAndStoreAllStorableToasts(); - } - } - // *TODO: mantipov: what we have to do with derived classes: LLNotificationWellWindow & LLIMWelWindow? // See EXT-3081 for details // for Message Well floater showed in a docked state - adjust channel's height - if(dynamic_cast<LLSysWellWindow*>(floater)) + if(dynamic_cast<LLSysWellWindow*>(floater) || dynamic_cast<LLIMFloater*>(floater)) { S32 channel_bottom = gViewerWindow->getWorldViewRectScaled().mBottom + gSavedSettings.getS32("ChannelBottomPanelMargin");; LLRect this_rect = getRect(); if(floater->getVisible() && floater->isDocked()) { - channel_bottom += (floater->getRect().getHeight() + gSavedSettings.getS32("ToastGap")); + channel_bottom = floater->getRect().mTop + gSavedSettings.getS32("ToastGap"); } if(channel_bottom != this_rect.mBottom) diff --git a/indra/newview/llscreenchannel.h b/indra/newview/llscreenchannel.h index 67f1c9bdc6..e384b17a0c 100644 --- a/indra/newview/llscreenchannel.h +++ b/indra/newview/llscreenchannel.h @@ -265,6 +265,8 @@ private: // create the StartUp Toast void createStartUpToast(S32 notif_num, F32 timer); + static F32 getHeightRatio(); + // Channel's flags static bool mWasStartUpToastShown; diff --git a/indra/newview/llsyswellwindow.cpp b/indra/newview/llsyswellwindow.cpp index bef7f5d6aa..26caf0be69 100644 --- a/indra/newview/llsyswellwindow.cpp +++ b/indra/newview/llsyswellwindow.cpp @@ -170,6 +170,7 @@ void LLSysWellWindow::setVisible(BOOL visible) if(mChannel) { mChannel->updateShowToastsState(); + mChannel->redrawToasts(); } } |