From 50b69c3f97c0b58791f7dd67f8b2fbdc9e8ef503 Mon Sep 17 00:00:00 2001
From: AlexanderP ProductEngine <apaschenko@productengine.com>
Date: Fri, 16 Nov 2012 12:38:40 +0200
Subject: [PATCH] CHUI-487, CHUI-488 W.I.P. #3 (Enable flashing FUI button
 behavior and Implement Flashing Conversations panel line item behavior):
 implemented conversation's item flashing

---
 indra/llui/llbutton.cpp                |  6 +++++-
 indra/llui/llfolderviewitem.cpp        | 16 ++++++++++++----
 indra/llui/llfolderviewitem.h          |  2 ++
 indra/newview/llflashtimer.cpp         | 14 ++++++++++++--
 indra/newview/llflashtimer.h           |  6 +++++-
 indra/newview/llfloaterimcontainer.cpp | 11 +++++++++++
 indra/newview/llfloaterimcontainer.h   |  1 +
 7 files changed, 48 insertions(+), 8 deletions(-)

diff --git a/indra/llui/llbutton.cpp b/indra/llui/llbutton.cpp
index 705fe165593..3b9076ee54b 100644
--- a/indra/llui/llbutton.cpp
+++ b/indra/llui/llbutton.cpp
@@ -176,7 +176,11 @@ LLButton::LLButton(const LLButton::Params& p)
 {
 	static LLUICachedControl<S32> llbutton_orig_h_pad ("UIButtonOrigHPad", 0);
 	static Params default_params(LLUICtrlFactory::getDefaultParams<LLButton>());
-
+if (this->getName() == "chat")
+{
+bool q = false;
+q = !q;
+}
 	if (!p.label_selected.isProvided())
 	{
 		mSelectedLabel = mUnselectedLabel;
diff --git a/indra/llui/llfolderviewitem.cpp b/indra/llui/llfolderviewitem.cpp
index 822534ffcfd..90568f344aa 100755
--- a/indra/llui/llfolderviewitem.cpp
+++ b/indra/llui/llfolderviewitem.cpp
@@ -23,9 +23,11 @@
 * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
 * $/LicenseInfo$
 */
+
+#include "../newview/llflashtimer.h"
+
 #include "linden_common.h"
 #include "llfolderviewitem.h"
-
 #include "llfolderview.h"
 #include "llfolderviewmodel.h"
 #include "llpanel.h"
@@ -142,6 +144,8 @@ LLFolderViewItem::LLFolderViewItem(const LLFolderViewItem::Params& p)
     mArrowSize(p.arrow_size),
     mMaxFolderItemOverlap(p.max_folder_item_overlap)
 {
+	mFlashTimer = new LLFlashTimer();
+
 	sFgColor = LLUIColorTable::instance().getColor("MenuItemEnabledColor", DEFAULT_WHITE);
 	sHighlightBgColor = LLUIColorTable::instance().getColor("MenuItemHighlightBgColor", DEFAULT_WHITE);
 	sHighlightFgColor = LLUIColorTable::instance().getColor("MenuItemHighlightFgColor", DEFAULT_WHITE);
@@ -676,12 +680,16 @@ void LLFolderViewItem::drawHighlight(const BOOL showContent, const BOOL hasKeybo
     const S32 focus_bottom = getRect().getHeight() - mItemHeight;
     const bool folder_open = (getRect().getHeight() > mItemHeight + 4);
     const S32 FOCUS_LEFT = 1;
+    bool flashing = mFlashTimer->isFlashing();
+
+    if (flashing? mFlashTimer->isHighlight() : mIsSelected) // always render "current" item (only render other selected items if
+    	             // mShowSingleSelection is FALSE) or flashing item
 
-    if (mIsSelected) // always render "current" item.  Only render other selected items if mShowSingleSelection is FALSE
     {
         gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
         LLColor4 bg_color = bgColor;
-        if (!mIsCurSelection)
+        bool selection = flashing? mFlashTimer->isHighlight() : mIsCurSelection;
+        if (!selection)
         {
             // do time-based fade of extra objects
             F32 fade_time = (getRoot() ? getRoot()->getSelectionFadeElapsedTime() : 0.0f);
@@ -701,7 +709,7 @@ void LLFolderViewItem::drawHighlight(const BOOL showContent, const BOOL hasKeybo
             getRect().getWidth() - 2,
             focus_bottom,
             bg_color, hasKeyboardFocus);
-        if (mIsCurSelection)
+        if (selection)
         {
             gl_rect_2d(FOCUS_LEFT, 
                 focus_top, 
diff --git a/indra/llui/llfolderviewitem.h b/indra/llui/llfolderviewitem.h
index 152ca242e16..c16d65206f7 100755
--- a/indra/llui/llfolderviewitem.h
+++ b/indra/llui/llfolderviewitem.h
@@ -29,6 +29,7 @@
 #include "llview.h"
 #include "lluiimage.h"
 
+class LLFlashTimer;
 class LLFolderView;
 class LLFolderViewModelItem;
 class LLFolderViewFolder;
@@ -272,6 +273,7 @@ class LLFolderViewItem : public LLView
 
 private:
 	static std::map<U8, LLFontGL*> sFonts; // map of styles to fonts
+	LLFlashTimer* mFlashTimer;
 
 };
 
diff --git a/indra/newview/llflashtimer.cpp b/indra/newview/llflashtimer.cpp
index f44ca9f90ce..2feacfa2181 100644
--- a/indra/newview/llflashtimer.cpp
+++ b/indra/newview/llflashtimer.cpp
@@ -29,11 +29,13 @@
 
 #include "llflashtimer.h"
 #include "llviewercontrol.h"
+#include "lleventtimer.h"
 
 LLFlashTimer::LLFlashTimer(callback_t cb, S32 count, F32 period)
 		: LLEventTimer(period)
 		, mCallback(cb)
 		, mCurrentTickCount(0)
+        , mIsFlashing(false)
 {
 	mEventTimer.stop();
 
@@ -49,8 +51,11 @@ LLFlashTimer::LLFlashTimer(callback_t cb, S32 count, F32 period)
 
 BOOL LLFlashTimer::tick()
 {
-	bool blink = !(mCurrentTickCount % 2);
-	mCallback(blink);
+	mIsHighlight = !(mCurrentTickCount % 2);
+	if (mCallback)
+	{
+		mCallback(mIsHighlight);
+	}
 
 	if (++mCurrentTickCount >= mFlashCount)
 	{
@@ -63,10 +68,15 @@ BOOL LLFlashTimer::tick()
 void LLFlashTimer::startFlashing()
 {
 	mCurrentTickCount = 0;
+	mIsFlashing = true;
 	mEventTimer.start();
 }
 
 void LLFlashTimer::stopFlashing()
 {
+	mIsFlashing = false;
+	mIsHighlight = false;
 	mEventTimer.stop();
 }
+
+
diff --git a/indra/newview/llflashtimer.h b/indra/newview/llflashtimer.h
index 95e458dff63..c030edfc52b 100644
--- a/indra/newview/llflashtimer.h
+++ b/indra/newview/llflashtimer.h
@@ -42,13 +42,15 @@ class LLFlashTimer : public LLEventTimer
 	 * @param period - how frequently callback should be called
 	 * @param cb - callback to be called each tick
 	 */
-	LLFlashTimer(callback_t cb, S32 count = 0, F32 period = 0.0);
+	LLFlashTimer(callback_t cb = NULL, S32 count = 0, F32 period = 0.0);
 	~LLFlashTimer() {};
 
 	/*virtual*/ BOOL tick();
 
 	void startFlashing();
 	void stopFlashing();
+	bool isFlashing() {return mIsFlashing;}
+	bool isHighlight() {return mIsHighlight;}
 
 private:
 	callback_t		mCallback;
@@ -57,6 +59,8 @@ class LLFlashTimer : public LLEventTimer
 	 */
 	S32 mFlashCount;
 	S32 mCurrentTickCount;
+	bool mIsHighlight;
+	bool mIsFlashing;
 };
 
 #endif /* LL_FLASHTIMER_H */
diff --git a/indra/newview/llfloaterimcontainer.cpp b/indra/newview/llfloaterimcontainer.cpp
index aebfdb5bce2..da6f3a484d1 100644
--- a/indra/newview/llfloaterimcontainer.cpp
+++ b/indra/newview/llfloaterimcontainer.cpp
@@ -1154,6 +1154,7 @@ void LLFloaterIMContainer::selectConversation(const LLUUID& session_id)
 	}
 }
 
+
 // Synchronous select the conversation item and the conversation floater
 BOOL LLFloaterIMContainer::selectConversationPair(const LLUUID& session_id, bool select_widget)
 {
@@ -1596,4 +1597,14 @@ void LLFloaterIMContainer::reSelectConversation()
 
 }
 
+void LLFloaterIMContainer::flashConversationItemWidget(const LLUUID& session_id)
+{
+	LLFolderViewItem* widget = get_ptr_in_map(mConversationsWidgets,session_id);
+	if (widget)
+	{
+		widget->;
+	}
+
+}
+
 // EOF
diff --git a/indra/newview/llfloaterimcontainer.h b/indra/newview/llfloaterimcontainer.h
index afc8d00174e..443688668bd 100644
--- a/indra/newview/llfloaterimcontainer.h
+++ b/indra/newview/llfloaterimcontainer.h
@@ -164,6 +164,7 @@ class LLFloaterIMContainer
 	void setTimeNow(const LLUUID& session_id, const LLUUID& participant_id);
 	void setNearbyDistances();
 	void reSelectConversation();
+	void flashConversationItemWidget(const LLUUID& session_id);
 
 private:
 	LLConversationViewSession* createConversationItemWidget(LLConversationItem* item);
-- 
GitLab