From 8adca4583ec95ac063f79990ac092998f24415b8 Mon Sep 17 00:00:00 2001
From: Merov Linden <merov@lindenlab.com>
Date: Tue, 18 Dec 2012 22:57:56 -0800
Subject: CHUI-600 : WIP : Flash conversation item in different color than
 select and start flashing only when shown

---
 indra/llui/llfolderviewitem.cpp | 46 ++++++++++++++++++++++++++---------------
 1 file changed, 29 insertions(+), 17 deletions(-)

(limited to 'indra/llui/llfolderviewitem.cpp')

diff --git a/indra/llui/llfolderviewitem.cpp b/indra/llui/llfolderviewitem.cpp
index 0a06ce66aa..100904c5a2 100755
--- a/indra/llui/llfolderviewitem.cpp
+++ b/indra/llui/llfolderviewitem.cpp
@@ -50,6 +50,7 @@ std::map<U8, LLFontGL*> LLFolderViewItem::sFonts; // map of styles to fonts
 bool LLFolderViewItem::sColorSetInitialized = false;
 LLUIColor LLFolderViewItem::sFgColor;
 LLUIColor LLFolderViewItem::sHighlightBgColor;
+LLUIColor LLFolderViewItem::sFlashBgColor;
 LLUIColor LLFolderViewItem::sFocusOutlineColor;
 LLUIColor LLFolderViewItem::sMouseOverColor;
 LLUIColor LLFolderViewItem::sFilterBGColor;
@@ -151,6 +152,7 @@ LLFolderViewItem::LLFolderViewItem(const LLFolderViewItem::Params& p)
 	{
 		sFgColor = LLUIColorTable::instance().getColor("MenuItemEnabledColor", DEFAULT_WHITE);
 		sHighlightBgColor = LLUIColorTable::instance().getColor("MenuItemHighlightBgColor", DEFAULT_WHITE);
+		sFlashBgColor = LLUIColorTable::instance().getColor("MenuItemFlashBgColor", DEFAULT_WHITE);
 		sFocusOutlineColor = LLUIColorTable::instance().getColor("InventoryFocusOutlineColor", DEFAULT_WHITE);
 		sMouseOverColor = LLUIColorTable::instance().getColor("InventoryMouseOverColor", DEFAULT_WHITE);
 		sFilterBGColor = LLUIColorTable::instance().getColor("FilterBackgroundColor", DEFAULT_WHITE);
@@ -686,26 +688,31 @@ void LLFolderViewItem::drawOpenFolderArrow(const Params& default_params, const L
 	return mIsCurSelection;
 }
 
-void LLFolderViewItem::drawHighlight(const BOOL showContent, const BOOL hasKeyboardFocus, const LLUIColor &bgColor, 
+void LLFolderViewItem::drawHighlight(const BOOL showContent, const BOOL hasKeyboardFocus, const LLUIColor &selectColor, const LLUIColor &flashColor,  
                                                         const LLUIColor &focusOutlineColor, const LLUIColor &mouseOverColor)
 {
-
-    //--------------------------------------------------------------------------------//
-    // Draw highlight for selected items
-    //
-
     const S32 focus_top = getRect().getHeight();
     const S32 focus_bottom = getRect().getHeight() - mItemHeight;
     const bool folder_open = (getRect().getHeight() > mItemHeight + 4);
     const S32 FOCUS_LEFT = 1;
+	
+	// Determine which background color to use for highlighting
+	LLUIColor bgColor = (isFlashing() ? flashColor : selectColor);
 
-    if (isHighlightAllowed())	// always render "current" item (only render other selected items if
-    							// mShowSingleSelection is FALSE) or flashing item
+    //--------------------------------------------------------------------------------//
+    // Draw highlight for selected items
+	// Note: Always render "current" item or flashing item, only render other selected 
+	// items if mShowSingleSelection is FALSE.
+    //
+    if (isHighlightAllowed())	
+    							
     {
         gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
-        LLColor4 bg_color = bgColor;
-        if (!isHighlightActive())
+		
+		// Highlight for selected but not current items
+        if (!isHighlightActive() && !isFlashing())
         {
+			LLColor4 bg_color = bgColor;
             // do time-based fade of extra objects
             F32 fade_time = (getRoot() ? getRoot()->getSelectionFadeElapsedTime() : 0.0f);
             if (getRoot() && getRoot()->getShowSingleSelection())
@@ -718,25 +725,30 @@ void LLFolderViewItem::drawHighlight(const BOOL showContent, const BOOL hasKeybo
                 // fading in
                 bg_color.mV[VALPHA] = clamp_rescale(fade_time, 0.f, 0.4f, 0.f, bg_color.mV[VALPHA]);
             }
+        	gl_rect_2d(FOCUS_LEFT,
+					   focus_top,
+					   getRect().getWidth() - 2,
+					   focus_bottom,
+					   bg_color, hasKeyboardFocus);
         }
 
-        if (isHighlightAllowed() || isHighlightActive())
+		// Highlight for currently selected or flashing item
+        if (isHighlightActive())
         {
+			// Background
         	gl_rect_2d(FOCUS_LEFT,
                 focus_top,
                 getRect().getWidth() - 2,
                 focus_bottom,
-                bg_color, hasKeyboardFocus);
-        }
-
-        if (isHighlightActive())
-        {
+                bgColor, hasKeyboardFocus);
+			// Outline
             gl_rect_2d(FOCUS_LEFT, 
                 focus_top, 
                 getRect().getWidth() - 2,
                 focus_bottom,
                 focusOutlineColor, FALSE);
         }
+
         if (folder_open)
         {
             gl_rect_2d(FOCUS_LEFT,
@@ -810,7 +822,7 @@ void LLFolderViewItem::draw()
 
     drawOpenFolderArrow(default_params, sFgColor);
 
-    drawHighlight(show_context, filled, sHighlightBgColor, sFocusOutlineColor, sMouseOverColor);
+    drawHighlight(show_context, filled, sHighlightBgColor, sFlashBgColor, sFocusOutlineColor, sMouseOverColor);
 
 	//--------------------------------------------------------------------------------//
 	// Draw open icon
-- 
cgit v1.2.3