Commits

richard_linden committed ad80010 Merge
  • Participants
  • Parent commits 9a27029, f7e68ae

Comments (0)

Files changed (6)

File indra/llui/lltoolbar.cpp

 	LLRect button_rect;
 	while (it_button != end_button)
 	{
-		button_rect  = (*it_button)->getRect();
+		button_rect = (*it_button)->getRect();
 		S32 point_x = button_rect.mRight + mPadRight;
 		S32 point_y = button_rect.mBottom - mPadBottom;
 
 			S32 mid_point = (button_rect.mRight + button_rect.mLeft) / 2;
 			if (button_panel_x < mid_point)
 			{
-				mDragx = button_rect.mLeft - mPadLeft;
-				mDragy = button_rect.mTop + mPadTop;
-			}
-			else
-			{
+		mDragx = button_rect.mLeft - mPadLeft;
+		mDragy = button_rect.mTop + mPadTop;
+	}
+	else
+	{
 				rank++;
 				mDragx = button_rect.mRight + mPadRight - 1;
 				mDragy = button_rect.mTop + mPadTop;
 	{
 		// We hit passed the end of the list so put the insertion point at the end
 		if (orientation == LLLayoutStack::HORIZONTAL)
-		{
+	{
 			mDragx = button_rect.mRight + mPadRight;
 			mDragy = button_rect.mTop + mPadTop;
-		}
-		else
-		{
+	}
+	else
+	{
 			mDragx = button_rect.mLeft - mPadLeft;
 			mDragy = button_rect.mBottom - mPadBottom;
 		}
 			if (command && btn->mIsEnabledSignal)
 			{
 				const bool button_command_enabled = (*btn->mIsEnabledSignal)(btn, command->isEnabledParameters());
+				// TODO: make button appear disabled but have it still respond to drag and drop
 				btn->setEnabled(button_command_enabled);
 			}
 
 	mIsDragged = false;
 }
 
+void LLToolBarButton::onCommit()
+{
+	LLCommand* command = LLCommandManager::instance().getCommand(mId);
+
+	if (!mIsEnabledSignal || (*mIsEnabledSignal)(this, command->isEnabledParameters()))
+	{
+		LLButton::onCommit();
+	}
+}
+
 void LLToolBarButton::reshape(S32 width, S32 height, BOOL called_from_parent)
 {
 	LLButton::reshape(mWidthRange.clamp(width), height, called_from_parent);
 
 
 
-
-
-

File indra/llui/lltoolbar.h

 	void onMouseEnter(S32 x, S32 y, MASK mask);
 	void onMouseCaptureLost();
 
+	void onCommit();
+
 	virtual const std::string getToolTip() const;		
 
-
-
 private:
 	LLCommandId		mId;
 	S32				mMouseDownX;

File indra/newview/llchannelmanager.cpp

 	LLScreenChannelBase::Params p;
 	p.id = LLUUID(gSavedSettings.getString("NotificationChannelUUID"));
 	p.channel_align = CA_RIGHT;
+	p.toast_align = NA_TOP;
 
 	// Getting a Channel for our notifications
 	return dynamic_cast<LLScreenChannel*> (LLChannelManager::getInstance()->getChannel(p));

File indra/newview/llnearbychathandler.cpp

 	void onToastDestroyed	(LLToast* toast, bool app_quitting);
 	void onToastFade		(LLToast* toast);
 
-	void reshape			(S32 width, S32 height, BOOL called_from_parent);
-
 	void redrawToasts()
 	{
 		arrangeToasts();
 	}
 
 	LLRect	toast_rect;	
-	updateBottom();
+	updateRect();
 
 	LLRect channel_rect;
 	floater_snap_region->localRectToOtherView(floater_snap_region->getLocalRect(), &channel_rect, gFloaterView);
 		}
 	}
 
-	}
+}
 
-void LLNearbyChatScreenChannel::reshape			(S32 width, S32 height, BOOL called_from_parent)
-{
-	LLScreenChannelBase::reshape(width, height, called_from_parent);
-	arrangeToasts();
-}
 
 
 //-----------------------------------------------------------------------------------------------

File indra/newview/llscreenchannel.cpp

 #include "llsyswellwindow.h"
 #include "llimfloater.h"
 #include "llscriptfloater.h"
+#include "llrootview.h"
 
 #include <algorithm>
 
 
 bool LLScreenChannel::mWasStartUpToastShown = false;
 
+LLFastTimer::DeclareTimer FTM_GET_CHANNEL_RECT("Calculate Notification Channel Region");
+LLRect LLScreenChannelBase::getChannelRect()
+{
+	LLFastTimer _(FTM_GET_CHANNEL_RECT);
+	LLRect channel_rect;
+	LLRect chiclet_rect;
+	LLView* floater_snap_region = gViewerWindow->getRootView()->getChildView("floater_snap_region");
+	floater_snap_region->localRectToScreen(floater_snap_region->getLocalRect(), &channel_rect);
 
-LLRect get_channel_rect()
-{
-	LLRect channel_rect;
-	LLView* floater_snap_region = LLUI::getRootView()->getChildView("floater_snap_region");
-	floater_snap_region->localRectToScreen(floater_snap_region->getLocalRect(), &channel_rect);
+	LLView* chiclet_region = gViewerWindow->getRootView()->getChildView("chiclet_container");
+	chiclet_region->localRectToScreen(chiclet_region->getLocalRect(), &chiclet_rect);
+
+	channel_rect.mTop = chiclet_rect.mBottom;
 	return channel_rect;
 }
 
 	setVisible(FALSE);
 }
 
+void LLScreenChannelBase::reshape(S32 width, S32 height, BOOL called_from_parent)
+{
+	redrawToasts();
+}
+
 bool  LLScreenChannelBase::isHovering()
 {
 	if (!mHoveredToast)
 
 void LLScreenChannelBase::init(S32 channel_left, S32 channel_right)
 {
-	// top and bottom set by updateBottom()
+	// top and bottom set by updateRect()
 	setRect(LLRect(channel_left, 0, channel_right, 0));
-	updateBottom();
+	updateRect();
 	setVisible(TRUE);
 }
 
-void	LLScreenChannelBase::updateBottom()
+void	LLScreenChannelBase::updateRect()
 {
-	S32 channel_top = get_channel_rect().mTop;
-	S32 channel_bottom = get_channel_rect().mBottom + gSavedSettings.getS32("ChannelBottomPanelMargin");
+	S32 channel_top = getChannelRect().mTop;
+	S32 channel_bottom = getChannelRect().mBottom + gSavedSettings.getS32("ChannelBottomPanelMargin");
 	S32 channel_left = getRect().mLeft;
 	S32 channel_right = getRect().mRight;
 	setRect(LLRect(channel_left, channel_top, channel_right, channel_bottom));
 void LLScreenChannel::init(S32 channel_left, S32 channel_right)
 {
 	LLScreenChannelBase::init(channel_left, channel_right);
-	LLRect channel_rect = get_channel_rect();
+	LLRect channel_rect = getChannelRect();
 	updatePositionAndSize(channel_rect);
 }
 
 //--------------------------------------------------------------------------
 void LLScreenChannel::redrawToasts()
 {
+	LLView* floater_snap_region = gViewerWindow->getRootView()->getChildView("floater_snap_region");
+
+	if (!getParent())
+	{
+		// connect to floater snap region just to get resize events, we don't care about being a proper widget 
+		floater_snap_region->addChild(this);
+		setFollows(FOLLOWS_ALL);
+	}
+
 	if(mToastList.size() == 0)
 		return;
 
 	S32		toast_margin = 0;
 	std::vector<ToastElem>::reverse_iterator it;
 
-	updateBottom();
+	updateRect();
 
 	LLDockableFloater* floater = dynamic_cast<LLDockableFloater*>(LLDockableFloater::getInstanceHandle().get());
 
 				(*it).toast->translate(0, shift);
 			}
 
-			LLRect channel_rect = get_channel_rect();
+			LLRect channel_rect = getChannelRect();
 			// don't show toasts if there is not enough space
 			if(toast_rect.mTop > channel_rect.mTop)
 			{
 //--------------------------------------------------------------------------
 void LLScreenChannel::showToastsTop()
 {
+	LLRect channel_rect = getChannelRect();
+
+	LLRect	toast_rect;	
+	S32		top = channel_rect.mTop;
+	S32		toast_margin = 0;
+	std::vector<ToastElem>::reverse_iterator it;
+
+	updateRect();
+
+	LLDockableFloater* floater = dynamic_cast<LLDockableFloater*>(LLDockableFloater::getInstanceHandle().get());
+
+	for(it = mToastList.rbegin(); it != mToastList.rend(); ++it)
+	{
+		if(it != mToastList.rbegin())
+		{
+			LLToast* toast = (*(it-1)).toast;
+			top = toast->getRect().mBottom - toast->getTopPad();
+			toast_margin = gSavedSettings.getS32("ToastGap");
+		}
+
+		toast_rect = (*it).toast->getRect();
+		toast_rect.setLeftTopAndSize(channel_rect.mRight - toast_rect.getWidth(),
+			top, toast_rect.getWidth(),
+			toast_rect.getHeight());
+		(*it).toast->setRect(toast_rect);
+
+		if(floater && floater->overlapsScreenChannel())
+		{
+			if(it == mToastList.rbegin())
+			{
+				// move first toast above docked floater
+				S32 shift = -floater->getRect().getHeight();
+				if(floater->getDockControl())
+				{
+					shift -= floater->getDockControl()->getTongueHeight();
+				}
+				(*it).toast->translate(0, shift);
+			}
+
+			LLRect channel_rect = getChannelRect();
+			// don't show toasts if there is not enough space
+			if(toast_rect.mBottom < channel_rect.mBottom)
+			{
+				break;
+			}
+		}
+
+		bool stop_showing_toasts = (*it).toast->getRect().mBottom < channel_rect.mBottom;
+
+		if(!stop_showing_toasts)
+		{
+			if( it != mToastList.rend()-1)
+			{
+				S32 toast_bottom = (*it).toast->getRect().mBottom - gSavedSettings.getS32("ToastGap");
+				stop_showing_toasts = toast_bottom < channel_rect.mBottom;
+			}
+		} 
+
+		// at least one toast should be visible
+		if(it == mToastList.rbegin())
+		{
+			stop_showing_toasts = false;
+		}
+
+		if(stop_showing_toasts)
+			break;
+
+		if( !(*it).toast->getVisible() )
+		{
+			// HACK
+			// EXT-2653: it is necessary to prevent overlapping for secondary showed toasts
+			(*it).toast->setVisible(TRUE);
+		}		
+		if(!(*it).toast->hasFocus())
+		{
+			// Fixing Z-order of toasts (EXT-4862)
+			// Next toast will be positioned under this one.
+			gFloaterView->sendChildToBack((*it).toast);
+		}
+	}
+
+	// Dismiss toasts we don't have space for (STORM-391).
+	if(it != mToastList.rend())
+	{
+		mHiddenToastsNum = 0;
+		for(; it != mToastList.rend(); it++)
+		{
+			(*it).toast->hide();
+		}
+	}
 }
 
 //--------------------------------------------------------------------------
 		return;
 	}
 
-	updateBottom();
+	updateRect();
 }
 
 //--------------------------------------------------------------------------

File indra/newview/llscreenchannel.h

 
 	LLScreenChannelBase(const Params&);
 
+	void reshape(S32 width, S32 height, BOOL called_from_parent = TRUE);
+
 	// Channel's outfit-functions
 	// update channel's size and position in the World View
 	virtual void		updatePositionAndSize(LLRect rect);
 	LLHandle<LLScreenChannelBase> getHandle() { mRootHandle.bind(this); return mRootHandle; }
 
 protected:
-	void	updateBottom();
+	void	updateRect();
+	LLRect	getChannelRect();
 
 	// Channel's flags
 	bool		mControlHovering;