From 66ddb437f1eb8327ff74a26943400b9911289a15 Mon Sep 17 00:00:00 2001
From: Andrew Dyukov <adyukov@productengine.com>
Date: Mon, 31 May 2010 22:30:35 +0300
Subject: [PATCH] EXT-7087 FIXED Added flashing icons for im tabs and hooked
 them up in code

Added new attribute image_flash to button.xml which sets an image used for button icon when button is flashing.
Pointer to this image is stored in member mImageFlash from LLButton and is used in LLButton::draw(). There are two
ways an image can flash now - by making changes in color according to flash_color attribute or by changing icon from
current to the one specified in image_flash. Second way is used only if the name of flash icon is different from
"FlashIconAbsent" which is there by default. First way is used otherwise. Used new selfmade orange icons for
flashing tabs.

--HG--
branch : product-engine
---
 indra/llui/llbutton.cpp                       |  30 ++++++++++++++----
 indra/llui/llbutton.h                         |   8 +++++
 indra/llui/lltabcontainer.cpp                 |   8 ++++-
 indra/llui/lltabcontainer.h                   |   5 ++-
 .../containers/Toolbar_Left_Flash.png         | Bin 0 -> 356 bytes
 .../containers/Toolbar_Middle_Flash.png       | Bin 0 -> 316 bytes
 .../containers/Toolbar_Right_Flash.png        | Bin 0 -> 428 bytes
 .../skins/default/textures/textures.xml       |   3 ++
 .../default/xui/en/floater_im_container.xml   |   9 +++++-
 .../skins/default/xui/en/widgets/button.xml   |   1 +
 .../default/xui/en/widgets/tab_container.xml  |  15 +++++++--
 11 files changed, 66 insertions(+), 13 deletions(-)
 create mode 100644 indra/newview/skins/default/textures/containers/Toolbar_Left_Flash.png
 create mode 100644 indra/newview/skins/default/textures/containers/Toolbar_Middle_Flash.png
 create mode 100644 indra/newview/skins/default/textures/containers/Toolbar_Right_Flash.png

diff --git a/indra/llui/llbutton.cpp b/indra/llui/llbutton.cpp
index 0255061b12b..a8f72183fd7 100644
--- a/indra/llui/llbutton.cpp
+++ b/indra/llui/llbutton.cpp
@@ -128,6 +128,7 @@ LLButton::LLButton(const LLButton::Params& p)
 	mImageSelected(p.image_selected),
 	mImageDisabled(p.image_disabled),
 	mImageDisabledSelected(p.image_disabled_selected),
+	mImageFlash(p.image_flash),
 	mImagePressed(p.image_pressed),
 	mImagePressedSelected(p.image_pressed_selected),
 	mImageHoverSelected(p.image_hover_selected),
@@ -635,14 +636,24 @@ void LLButton::draw()
 
 	if (mFlashing)
 	{
-		LLColor4 flash_color = mFlashBgColor.get();
-		use_glow_effect = TRUE;
-		glow_type = LLRender::BT_ALPHA; // blend the glow
-
-		if (mNeedsHighlight) // highlighted AND flashing
-			glow_color = (glow_color*0.5f + flash_color*0.5f) % 2.0f; // average between flash and highlight colour, with sum of the opacity
+		// if we have icon for flashing, use it as image for button
+		if(flash && mImageFlash->getName() != "FlashIconAbsent")
+		{
+			// setting flash to false to avoid its further influence on glow
+			flash = false;
+			imagep = mImageFlash;
+		}
+		// else use usual flashing via flash_color
 		else
-			glow_color = flash_color;
+		{
+			LLColor4 flash_color = mFlashBgColor.get();
+			use_glow_effect = TRUE;
+			glow_type = LLRender::BT_ALPHA; // blend the glow
+			if (mNeedsHighlight) // highlighted AND flashing
+				glow_color = (glow_color*0.5f + flash_color*0.5f) % 2.0f; // average between flash and highlight colour, with sum of the opacity
+			else
+				glow_color = flash_color;
+		}
 	}
 
 	if (mNeedsHighlight && !imagep)
@@ -1018,6 +1029,11 @@ void LLButton::setImageHoverUnselected(LLPointer<LLUIImage> image)
 	mImageHoverUnselected = image;
 }
 
+void LLButton::setImageFlash(LLPointer<LLUIImage> image)
+{
+	mImageFlash = image;
+}
+
 void LLButton::setImageOverlay(const std::string& image_name, LLFontGL::HAlign alignment, const LLColor4& color)
 {
 	if (image_name.empty())
diff --git a/indra/llui/llbutton.h b/indra/llui/llbutton.h
index a4d81ed6c36..b251c3d65d9 100644
--- a/indra/llui/llbutton.h
+++ b/indra/llui/llbutton.h
@@ -84,6 +84,7 @@ class LLButton
 								image_hover_unselected,
 								image_disabled_selected,
 								image_disabled,
+								image_flash,
 								image_pressed,
 								image_pressed_selected,
 								image_overlay;
@@ -246,6 +247,7 @@ class LLButton
 	void			setImageHoverUnselected(LLPointer<LLUIImage> image);
 	void			setImageDisabled(LLPointer<LLUIImage> image);
 	void			setImageDisabledSelected(LLPointer<LLUIImage> image);
+	void			setImageFlash(LLPointer<LLUIImage> image);
 	void			setImagePressed(LLPointer<LLUIImage> image);
 
 	void			setCommitOnReturn(BOOL commit) { mCommitOnReturn = commit; }
@@ -310,6 +312,12 @@ class LLButton
 	LLPointer<LLUIImage>		mImagePressed;
 	LLPointer<LLUIImage>		mImagePressedSelected;
 
+	/* There are two ways an image can flash- by making changes in color according to flash_color attribute
+	   or by changing icon from current to the one specified in image_flash. Second way is used only if
+	   the name of flash icon is different from "FlashIconAbsent" which is there by default. First way is used 
+	   otherwise. */
+	LLPointer<LLUIImage>		mImageFlash;
+
 	LLUIColor					mHighlightColor;
 	LLUIColor					mFlashBgColor;
 
diff --git a/indra/llui/lltabcontainer.cpp b/indra/llui/lltabcontainer.cpp
index 30fc7babaef..986cfe75a12 100644
--- a/indra/llui/lltabcontainer.cpp
+++ b/indra/llui/lltabcontainer.cpp
@@ -197,10 +197,13 @@ static LLDefaultChildRegistry::Register<LLTabContainer> r2("tab_container");
 LLTabContainer::TabParams::TabParams()
 :	tab_top_image_unselected("tab_top_image_unselected"),
 	tab_top_image_selected("tab_top_image_selected"),
+	tab_top_image_flash("tab_top_image_flash"),
 	tab_bottom_image_unselected("tab_bottom_image_unselected"),
 	tab_bottom_image_selected("tab_bottom_image_selected"),
+	tab_bottom_image_flash("tab_bottom_image_flash"),
 	tab_left_image_unselected("tab_left_image_unselected"),
-	tab_left_image_selected("tab_left_image_selected")
+	tab_left_image_selected("tab_left_image_selected"),
+	tab_left_image_flash("tab_left_image_flash")
 {}
 
 LLTabContainer::Params::Params()
@@ -879,16 +882,19 @@ void LLTabContainer::update_images(LLTabTuple* tuple, TabParams params, LLTabCon
 		{
 			tuple->mButton->setImageUnselected(static_cast<LLUIImage*>(params.tab_top_image_unselected));
 			tuple->mButton->setImageSelected(static_cast<LLUIImage*>(params.tab_top_image_selected));
+			tuple->mButton->setImageFlash(static_cast<LLUIImage*>(params.tab_top_image_flash));
 		}
 		else if (pos == LLTabContainer::BOTTOM)
 		{
 			tuple->mButton->setImageUnselected(static_cast<LLUIImage*>(params.tab_bottom_image_unselected));
 			tuple->mButton->setImageSelected(static_cast<LLUIImage*>(params.tab_bottom_image_selected));
+			tuple->mButton->setImageFlash(static_cast<LLUIImage*>(params.tab_bottom_image_flash));
 		}
 		else if (pos == LLTabContainer::LEFT)
 		{
 			tuple->mButton->setImageUnselected(static_cast<LLUIImage*>(params.tab_left_image_unselected));
 			tuple->mButton->setImageSelected(static_cast<LLUIImage*>(params.tab_left_image_selected));
+			tuple->mButton->setImageFlash(static_cast<LLUIImage*>(params.tab_left_image_flash));
 		}
 	}
 }
diff --git a/indra/llui/lltabcontainer.h b/indra/llui/lltabcontainer.h
index 50ec2679f6b..a2dc15aaf9c 100644
--- a/indra/llui/lltabcontainer.h
+++ b/indra/llui/lltabcontainer.h
@@ -67,10 +67,13 @@ class LLTabContainer : public LLPanel
 	{
 		Optional<LLUIImage*>				tab_top_image_unselected,
 											tab_top_image_selected,
+											tab_top_image_flash,
 											tab_bottom_image_unselected,
 											tab_bottom_image_selected,
+											tab_bottom_image_flash,
 											tab_left_image_unselected,
-											tab_left_image_selected;		
+											tab_left_image_selected,
+											tab_left_image_flash;		
 		TabParams();
 	};
 
diff --git a/indra/newview/skins/default/textures/containers/Toolbar_Left_Flash.png b/indra/newview/skins/default/textures/containers/Toolbar_Left_Flash.png
new file mode 100644
index 0000000000000000000000000000000000000000..9f1e2a469d601b675e9b117d07a837302a726a33
GIT binary patch
literal 356
zcmV-q0h|7bP)<h;3K|Lk000e1NJLTq0018V000>X1^@s6$@ldn0003iNkl<Zc-muR
zU|@*Z(&4-K@2_tR|Ns4G0D=Gi|1&T$GBUsbIv*PVsUa4C%wl9>VgQ*Kv%b-J@&A8+
ziPlUVzzDH?U7h`66kmX)aPzVHoGj~smana~U5s4{pK};+h>>XdnriFCB<rLCAj)!T
zCpZ+#S65mLoX=NPm<^oeE6Ys>&hq7@#sg>hiV~xNOK=NvwFl1f#rfI<f}J*H9N6+D
z`C0=P=S%W5@drCi{0$5CT#bSAIU&nwo8WTQ30Mwl0N^)>47(wgFUnCHxL{wDtvX-{
zE*xn23VfE)q74VL+yfZr+yDRjhu2`LTh0h+!%3<FL5VBdK`!P$4EP*DO#o}Xf`Fc)
zqM~4h2gd<!b|$)5{_D?wl&F;iVhtb`24W6+H~;{w?1(s33T_er0000<MNUMnLSTZ^
Cv6>wK

literal 0
HcmV?d00001

diff --git a/indra/newview/skins/default/textures/containers/Toolbar_Middle_Flash.png b/indra/newview/skins/default/textures/containers/Toolbar_Middle_Flash.png
new file mode 100644
index 0000000000000000000000000000000000000000..dd73d655e9bcc53bf3c967265380c0eeb47a1f13
GIT binary patch
literal 316
zcmV-C0mJ@@P)<h;3K|Lk000e1NJLTq0018V000>X1^@s6$@ldn00034Nkl<Zc-qC5
zTMmLS6hvE$A0}?Y7e!12fyi6qZruNeF;;E?B?uK-nohz;>Fu0OxdHG!NA#9o5q(hv
zqLd<xF{;%bcL{2S3cR3xzE~m*@Jo^nUObhsF{|Kl`b_~7%~Y*%XL1oZTma9bxMPa9
z9n^Dg<OTqqokQ7ER0E&7;XdHPlfly<(3d>%J$>-lJL!XmuA>hgImg}t<qhXrL?7I@
z38zfmJC4Bv+Z0$VuM)oBX~<o{eQT>PIS;PB;j9hE7z+7D0&M2V;2v4aou8mexVh?2
zg%mej6aMq-px~L;e*crJg4YelgR2rYjOrzGAo6Y_^>|YDc=dcw3%vmf(tbD^tYkj`
O0000<MNUMnLSTYdc86*J

literal 0
HcmV?d00001

diff --git a/indra/newview/skins/default/textures/containers/Toolbar_Right_Flash.png b/indra/newview/skins/default/textures/containers/Toolbar_Right_Flash.png
new file mode 100644
index 0000000000000000000000000000000000000000..f6b775c2a05e4b00cb51ed049c0ff27d0df66fb5
GIT binary patch
literal 428
zcmV;d0aN~oP)<h;3K|Lk000e1NJLTq0018V000>X1^@s6$@ldn0004VNkl<Zc-mvk
zab)=KV(-N8|NnmmVgVx~BVKusS;%UT`HW1A49sj?3_cZ`V;Mn~JJ~r9Z80?fBNH=2
zVEtZ*<&L)Yq-iD~{~t}we=K@}nhruOx3MMF?Px}06T_wk0fL(kLo9c&vZhLKk^(|n
zk3uZBx3nV7-y|kD{FYl-(B0>u?I$3X+nJlu-SV)GQxMB-%}nWTd3fh(h~?HM#&owl
zvimI5aw9{MG*TnMMf9A5SZ=JXMR&^+CSQeEZmvg~<)oK!m>_l{)N%`wEvFpBOuPp5
zxvnOi{SCBy(siiiIvRBMdF<pH5X;T9)k*U?6%rf;mgAQPwMz)8iJg2CX1N+=VMqpu
zn{o?cxv7>aX+9?)PfUV~n|d4SbD-rkZNp)44AAljx>$~(pNR<+=bmuO=>b5Ne*4S9
z(6jrO{cRwClyLgmbg}&F&wmUZJAOFazkmNdkb4OfHZgRunStR45WfZD8$kRVBme+Q
WbfyBl&DMbc0000<MNUMnLSTZB$iF}U

literal 0
HcmV?d00001

diff --git a/indra/newview/skins/default/textures/textures.xml b/indra/newview/skins/default/textures/textures.xml
index 29c72a414be..072ea40ee4c 100644
--- a/indra/newview/skins/default/textures/textures.xml
+++ b/indra/newview/skins/default/textures/textures.xml
@@ -527,15 +527,18 @@ with the same filename but different name
   <texture name="Tool_Grab" file_name="build/Tool_Grab.png" preload="false" />
   <texture name="Tool_Zoom" file_name="build/Tool_Zoom.png" preload="false" />
 
+  <texture name="Toolbar_Left_Flash" file_name="containers/Toolbar_Left_Flash.png" preload="false" scale.left="5" scale.bottom="4" scale.top="24" scale.right="30" />
   <texture name="Toolbar_Left_Off" file_name="containers/Toolbar_Left_Off.png" preload="false" scale.left="5" scale.bottom="4" scale.top="24" scale.right="30" />
   <texture name="Toolbar_Left_Over" file_name="containers/Toolbar_Left_Over.png" preload="false" scale.left="5" scale.bottom="4" scale.top="24" scale.right="30" />
   <texture name="Toolbar_Left_Selected" file_name="containers/Toolbar_Left_Selected.png" preload="false" scale.left="5" scale.bottom="4" scale.top="24" scale.right="30" />
   <texture name="Toolbar_Middle_Off" file_name="containers/Toolbar_Middle_Off.png" preload="false" scale.left="1" scale.bottom="2" scale.top="24" scale.right="30" />
   <texture name="Toolbar_Middle_Over" file_name="containers/Toolbar_Middle_Over.png" preload="false" scale.left="1" scale.bottom="2" scale.top="24" scale.right="30" />
   <texture name="Toolbar_Middle_Selected" file_name="containers/Toolbar_Middle_Selected.png" preload="false" scale.left="1" scale.bottom="2" scale.top="24" scale.right="30" />
+  <texture name="Toolbar_Middle_Flash" file_name="containers/Toolbar_Middle_Flash.png" preload="false" scale.left="5" scale.bottom="4" scale.top="24" scale.right="30" />
   <texture name="Toolbar_Right_Off" file_name="containers/Toolbar_Right_Off.png" preload="false" scale.left="1" scale.bottom="4" scale.top="24" scale.right="26" />
   <texture name="Toolbar_Right_Over" file_name="containers/Toolbar_Right_Over.png" preload="false" scale.left="1" scale.bottom="4" scale.top="24" scale.right="26" />
   <texture name="Toolbar_Right_Selected" file_name="containers/Toolbar_Right_Selected.png" preload="false" scale.left="1" scale.bottom="4" scale.top="24" scale.right="26" />
+  <texture name="Toolbar_Right_Flash" file_name="containers/Toolbar_Right_Flash.png" preload="false" scale.left="1" scale.bottom="4" scale.top="24" scale.right="26" />
 
   <texture name="Tooltip" file_name="widgets/Tooltip.png" preload="true" scale.left="2" scale.top="16" scale.right="100" scale.bottom="3" />
 
diff --git a/indra/newview/skins/default/xui/en/floater_im_container.xml b/indra/newview/skins/default/xui/en/floater_im_container.xml
index ced8c291993..e123de46c20 100644
--- a/indra/newview/skins/default/xui/en/floater_im_container.xml
+++ b/indra/newview/skins/default/xui/en/floater_im_container.xml
@@ -27,7 +27,14 @@
      halign="left"
      use_ellipses="true"
      top="0"
-     width="394" />
+     width="394">
+      <first_tab
+       tab_bottom_image_flash="Toolbar_Left_Flash"/>
+      <middle_tab
+       tab_bottom_image_flash="Toolbar_Middle_Flash"/>
+      <last_tab
+       tab_bottom_image_flash="Toolbar_Right_Flash"/>
+    </tab_container>
     <icon
      color="DefaultShadowLight"
      enabled="false"
diff --git a/indra/newview/skins/default/xui/en/widgets/button.xml b/indra/newview/skins/default/xui/en/widgets/button.xml
index c4f0fe52087..6dcc27b469d 100644
--- a/indra/newview/skins/default/xui/en/widgets/button.xml
+++ b/indra/newview/skins/default/xui/en/widgets/button.xml
@@ -7,6 +7,7 @@
         image_selected="PushButton_Selected"
         image_disabled_selected="PushButton_Selected_Disabled"
         image_disabled="PushButton_Disabled"
+        image_flash="FlashIconAbsent"
         image_top_pad="0"
         image_bottom_pad="0"
         imgoverlay_label_space="1"
diff --git a/indra/newview/skins/default/xui/en/widgets/tab_container.xml b/indra/newview/skins/default/xui/en/widgets/tab_container.xml
index 8d6b0c1cfe6..30b0a8462a7 100644
--- a/indra/newview/skins/default/xui/en/widgets/tab_container.xml
+++ b/indra/newview/skins/default/xui/en/widgets/tab_container.xml
@@ -13,20 +13,29 @@ label_pad_left - padding to the left of tab button labels
                label_pad_left="4">
   <first_tab tab_top_image_unselected="TabTop_Left_Off"
                tab_top_image_selected="TabTop_Left_Selected"
+               tab_top_image_flash="FlashIconAbsent"
                tab_bottom_image_unselected="Toolbar_Left_Off"
                tab_bottom_image_selected="Toolbar_Left_Selected"
+               tab_bottom_image_flash="FlashIconAbsent"
                tab_left_image_unselected="SegmentedBtn_Left_Disabled"
-               tab_left_image_selected="SegmentedBtn_Left_Selected_Over"/>
+               tab_left_image_selected="SegmentedBtn_Left_Selected_Over"
+               tab_left_image_flash="FlashIconAbsent"/>
   <middle_tab tab_top_image_unselected="TabTop_Middle_Off"
                tab_top_image_selected="TabTop_Middle_Selected"
+               tab_top_image_flash="FlashIconAbsent"
                tab_bottom_image_unselected="Toolbar_Middle_Off"
                tab_bottom_image_selected="Toolbar_Middle_Selected"
+               tab_bottom_image_flash="FlashIconAbsent"
                tab_left_image_unselected="SegmentedBtn_Left_Disabled"
-               tab_left_image_selected="SegmentedBtn_Left_Selected_Over"/>
+               tab_left_image_selected="SegmentedBtn_Left_Selected_Over"
+               tab_left_image_flash="FlashIconAbsent"/>
   <last_tab tab_top_image_unselected="TabTop_Right_Off"
                tab_top_image_selected="TabTop_Right_Selected"
+               tab_top_image_flash="FlashIconAbsent"
                tab_bottom_image_unselected="Toolbar_Right_Off"
                tab_bottom_image_selected="Toolbar_Right_Selected"
+               tab_bottom_image_flash="FlashIconAbsent"
                tab_left_image_unselected="SegmentedBtn_Left_Disabled"
-               tab_left_image_selected="SegmentedBtn_Left_Selected_Over"/>
+               tab_left_image_selected="SegmentedBtn_Left_Selected_Over"
+               tab_left_image_flash="FlashIconAbsent"/>
 </tab_container>
-- 
GitLab