FIRE-756, Resizable NearbyChat Toasts, patch by Zi Ree

meow-7.2.2
Arrehn 2011-03-30 08:48:33 -07:00
parent 0947350ad9
commit 8889491a42
3 changed files with 73 additions and 1 deletions

View File

@ -6425,6 +6425,17 @@ Change of this parameter will affect the layout of buttons in notification toast
<key>Value</key>
<integer>72</integer>
</map>
<key>NearbyToastWidth</key>
<map>
<key>Comment</key>
<string>Width of a the nearby chat toasts in percent of screen width</string>
<key>Persist</key>
<integer>1</integer>
<key>Type</key>
<string>S32</string>
<key>Value</key>
<integer>33</integer>
</map>
<key>NotifyMoneyChange</key>
<map>
<key>Comment</key>

View File

@ -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<LLNearbyChatToastPanel*>(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();

View File

@ -491,6 +491,34 @@
width="50">
pixels
</text>
<slider
control_name="NearbyToastWidth"
decimal_digits="0"
follows="left|top"
height="16"
increment="1"
label="Width of Nearby Chat Toast:"
tool_tip="Width of a the nearby chat toasts in percent of screen width"
label_width="155"
layout="topleft"
left="210"
min_val="1"
max_val="90"
name="OverflowToastHeight"
top_pad="7"
width="272" />
<text
type="string"
length="1"
follows="left|top"
height="16"
layout="topleft"
left_delta="269"
name="OverflowToastHeightText"
top_delta="0"
width="50">
%
</text>
</panel>
</panel>