From 8889491a42a9366ed35e2e2f5f19908174d074c9 Mon Sep 17 00:00:00 2001 From: Arrehn Date: Wed, 30 Mar 2011 08:48:33 -0700 Subject: [PATCH] FIRE-756, Resizable NearbyChat Toasts, patch by Zi Ree --- indra/newview/app_settings/settings.xml | 11 ++++++ indra/newview/llnearbychathandler.cpp | 35 ++++++++++++++++++- .../default/xui/en/panel_preferences_UI.xml | 28 +++++++++++++++ 3 files changed, 73 insertions(+), 1 deletion(-) diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index 76ff682576..5c50165dcb 100644 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -6425,6 +6425,17 @@ Change of this parameter will affect the layout of buttons in notification toast Value 72 + NearbyToastWidth + + Comment + Width of a the nearby chat toasts in percent of screen width + Persist + 1 + Type + S32 + Value + 33 + NotifyMoneyChange Comment diff --git a/indra/newview/llnearbychathandler.cpp b/indra/newview/llnearbychathandler.cpp index 8733683873..ac6af69fcf 100644 --- a/indra/newview/llnearbychathandler.cpp +++ b/indra/newview/llnearbychathandler.cpp @@ -67,6 +67,7 @@ public: LLNearbyChatScreenChannel(const LLUUID& id):LLScreenChannelBase(id) { + mWorldViewRectConnection = gViewerWindow->setOnWorldViewRectUpdated(boost::bind(&LLNearbyChatScreenChannel::updateSize, this, _1, _2)); mStopProcessing = false; LLControlVariable* ctrl = gSavedSettings.getControl("NearbyToastLifeTime").get(); @@ -145,7 +146,11 @@ protected: void updateToastFadingTime(); + void reshapePanel(LLToastPanelBase* panel); + virtual void updateSize(LLRect old_world_rect, LLRect new_world_rect); + create_toast_panel_callback_t m_create_toast_panel_callback_t; + boost::signals2::connection mWorldViewRectConnection; bool createPoolToast(); @@ -190,6 +195,32 @@ private: // LLNearbyChatScreenChannel //----------------------------------------------------------------------------------------------- +void LLNearbyChatScreenChannel::reshapePanel(LLToastPanelBase* panel) +{ + S32 percentage=gSavedSettings.getS32("NearbyToastWidth"); + panel->reshape(gViewerWindow->getWindowWidthRaw()*percentage/100,panel->getRect().getHeight(),TRUE); +} + +void LLNearbyChatScreenChannel::updateSize(LLRect old_world_rect, LLRect new_world_rect) +{ + for(toast_vec_t::iterator it = m_active_toasts.begin(); it != m_active_toasts.end(); ++it) + { + LLToast* toast = it->get(); + + if (toast) + { + LLNearbyChatToastPanel* panel = dynamic_cast(toast->getPanel()); + + if(panel) + { + reshapePanel(panel); + toast->reshapeToPanel(); + } + } + } + arrangeToasts(); +} + void LLNearbyChatScreenChannel::deactivateToast(LLToast* toast) { toast_vec_t::iterator pos = std::find(m_active_toasts.begin(), m_active_toasts.end(), toast->getHandle()); @@ -277,7 +308,7 @@ bool LLNearbyChatScreenChannel::createPoolToast() p.fading_time_secs = gSavedSettings.getS32("NearbyToastFadingTime"); LLToast* toast = new LLNearbyChatToast(p, this); - + reshapePanel(panel); toast->setOnFadeCallback(boost::bind(&LLNearbyChatScreenChannel::onToastFade, this, _1)); @@ -308,6 +339,7 @@ void LLNearbyChatScreenChannel::addNotification(LLSD& notification) if(panel && panel->messageID() == fromID && panel->getFromName() == from && panel->canAddText()) { panel->addMessage(notification); + reshapePanel(panel); toast->reshapeToPanel(); toast->startFading(); @@ -353,6 +385,7 @@ void LLNearbyChatScreenChannel::addNotification(LLSD& notification) return; panel->init(notification); + reshapePanel(panel); toast->reshapeToPanel(); toast->startFading(); diff --git a/indra/newview/skins/default/xui/en/panel_preferences_UI.xml b/indra/newview/skins/default/xui/en/panel_preferences_UI.xml index 39a86c5711..cf133bd3bc 100644 --- a/indra/newview/skins/default/xui/en/panel_preferences_UI.xml +++ b/indra/newview/skins/default/xui/en/panel_preferences_UI.xml @@ -491,6 +491,34 @@ width="50"> pixels + + + % +