Vadim ProductEngine avatar Vadim ProductEngine committed 33ccd6c

STORM-717 FIXED Made nearby chat toasts respect transparency settings:

* Normally toasts are as opaque as specified by "inactive floater opacity" setting.
* When mouse is hovering a toast, the toast uses "active floater opacity" setting.
* Fading toasts have 1/2 of "inactive floater opacity".

Comments (0)

Files changed (4)

indra/llui/lluictrl.cpp

 	case TT_INACTIVE:
 		alpha = sInactiveControlTransparency;
 		break;
+
+	case TT_FADING:
+		alpha = sInactiveControlTransparency / 2;
+		break;
 	}
 
 	return alpha;

indra/llui/lluictrl.h

 	enum ETypeTransparency
 	{
 		TT_DEFAULT,
-		TT_ACTIVE,
-		TT_INACTIVE
+		TT_ACTIVE,		// focused floater
+		TT_INACTIVE,	// other floaters
+		TT_FADING,		// fading toast
 	};
 	/*virtual*/ ~LLUICtrl();
 

indra/newview/llnearbychathandler.cpp

 	:	LLToast(p),
 	 	mNearbyChatScreenChannelp(nc_channelp)
 	{
+		updateTransparency();
+		setMouseEnterCallback(boost::bind(&LLNearbyChatToast::updateTransparency, this));
+		setMouseLeaveCallback(boost::bind(&LLNearbyChatToast::updateTransparency, this));
 	}
 
 	/*virtual*/ void onClose(bool app_quitting);
+	/*virtual*/ void setBackgroundOpaque(BOOL b);
+
+protected:
+	/*virtual*/ void setTransparentState(bool transparent);
 
 private:
+	void updateTransparency();
+
 	LLNearbyChatScreenChannel*	mNearbyChatScreenChannelp;
 };
 
 	mNearbyChatScreenChannelp->onToastDestroyed(this, app_quitting);
 }
 
+// virtual
+void LLNearbyChatToast::setBackgroundOpaque(BOOL b)
+{
+	// We don't want background changes: transparency is handled differently.
+	LLToast::setBackgroundOpaque(TRUE);
+}
+
+// virtual
+void LLNearbyChatToast::setTransparentState(bool transparent)
+{
+	LLToast::setTransparentState(transparent);
+	updateTransparency();
+}
+
+void LLNearbyChatToast::updateTransparency()
+{
+	ETypeTransparency transparency_type;
+
+	if (isHovered())
+	{
+		transparency_type = TT_ACTIVE;
+	}
+	else
+	{
+		transparency_type = getTransparentState() ? TT_FADING : TT_INACTIVE;
+	}
+
+	LLFloater::updateTransparency(transparency_type);
+}
+
 // EOF

indra/newview/lltoast.h

 	//
 	virtual void setVisible(BOOL show);
 
-	/*virtual*/ void setBackgroundOpaque(BOOL b);
+	virtual void setBackgroundOpaque(BOOL b);
 	//
 	virtual void hide();
 
 
 	LLHandle<LLToast> getHandle() { mHandle.bind(this); return mHandle; }
 
+	bool			getTransparentState() const { return mIsTransparent; }
+	virtual void	setTransparentState(bool transparent);
+
+
 private:
 
 	void onToastMouseEnter();
 
 	void expire();
 
-	void setTransparentState(bool transparent);
-
 	LLUUID				mNotificationID;
 	LLUUID				mSessionID;
 	LLNotificationPtr	mNotification;
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.