From 93e3c8e4a51dd60c202bc2e3f11b9ae850b2b6c8 Mon Sep 17 00:00:00 2001
From: Leslie Linden <leslie@lindenlab.com>
Date: Wed, 5 Oct 2011 16:28:40 -0700
Subject: [PATCH] EXP-1280 FIX -- Minimized floaters associated with toolbar
 buttons should change the state of their parent button

* Toolbar buttons now display green when its corresponding floater is open or
  minimized.
* Made changes to buttons so flash time and rate is configurable
* Removed unused "highlight_color" attribute from LLButton
* Implemented "isVisible" function for toolbar button floaters.  It returns true
  when the floater is visible or minimized.
* Toolbar floater unminimize now also puts focus to the floater
* All commands now specify their "is_running_function" for toolbar button state
* ButtonFlashCount and ButtonFlashRate have been moved to button.xml settings
  and are now configurable on the button.  Toolbar buttons are set to never
  flash and this functionality is used to show which buttons have windows open.
* All toybox buttons show hover glow even when disabled

Reviewed by Richard.
---
 indra/llui/llbutton.cpp                       | 24 ++---
 indra/llui/llbutton.h                         | 13 ++-
 indra/llui/llfloaterreg.cpp                   | 23 +++++
 indra/llui/llfloaterreg.h                     |  1 +
 indra/llui/lltoolbar.cpp                      | 89 +++++++++++++++++--
 indra/llui/lltoolbar.h                        | 12 ++-
 indra/llui/llui.cpp                           |  1 +
 indra/newview/app_settings/commands.xml       | 46 ++++++++++
 indra/newview/app_settings/settings.xml       | 22 -----
 .../default/xui/en/floater_test_button.xml    |  1 -
 .../skins/default/xui/en/floater_toybox.xml   | 13 +++
 .../skins/default/xui/en/widgets/button.xml   |  7 +-
 .../skins/default/xui/en/widgets/toolbar.xml  |  6 +-
 13 files changed, 210 insertions(+), 48 deletions(-)

diff --git a/indra/llui/llbutton.cpp b/indra/llui/llbutton.cpp
index f259e8027ea..c9ee62296fe 100644
--- a/indra/llui/llbutton.cpp
+++ b/indra/llui/llbutton.cpp
@@ -83,7 +83,6 @@ LLButton::Params::Params()
 	label_color_selected("label_color_selected"),	// requires is_toggle true
 	label_color_disabled("label_color_disabled"),
 	label_color_disabled_selected("label_color_disabled_selected"),
-	highlight_color("highlight_color"),
 	image_color("image_color"),
 	image_color_disabled("image_color_disabled"),
 	image_overlay_color("image_overlay_color", LLColor4::white),
@@ -99,10 +98,13 @@ LLButton::Params::Params()
 	scale_image("scale_image", true),
 	hover_glow_amount("hover_glow_amount"),
 	commit_on_return("commit_on_return", true),
+	display_pressed_state("display_pressed_state", true),
 	use_draw_context_alpha("use_draw_context_alpha", true),
 	badge("badge"),
 	handle_right_mouse("handle_right_mouse"),
-	held_down_delay("held_down_delay")
+	held_down_delay("held_down_delay"),
+	button_flash_count("button_flash_count"),
+	button_flash_rate("button_flash_rate")
 {
 	addSynonym(is_toggle, "toggle");
 	changeDefault(initial_value, LLSD(false));
@@ -136,7 +138,6 @@ LLButton::LLButton(const LLButton::Params& p)
 	mSelectedLabelColor(p.label_color_selected()),
 	mDisabledLabelColor(p.label_color_disabled()),
 	mDisabledSelectedLabelColor(p.label_color_disabled_selected()),
-	mHighlightColor(p.highlight_color()),
 	mImageColor(p.image_color()),
 	mFlashBgColor(p.flash_color()),
 	mDisabledImageColor(p.image_color_disabled()),
@@ -159,12 +160,15 @@ LLButton::LLButton(const LLButton::Params& p)
 	mCommitOnReturn(p.commit_on_return),
 	mFadeWhenDisabled(FALSE),
 	mForcePressedState(false),
+	mDisplayPressedState(p.display_pressed_state),
 	mLastDrawCharsCount(0),
 	mMouseDownSignal(NULL),
 	mMouseUpSignal(NULL),
 	mHeldDownSignal(NULL),
 	mUseDrawContextAlpha(p.use_draw_context_alpha),
-	mHandleRightMouse(p.handle_right_mouse)
+	mHandleRightMouse(p.handle_right_mouse),
+	mButtonFlashCount(p.button_flash_count),
+	mButtonFlashRate(p.button_flash_rate)
 {
 	static LLUICachedControl<S32> llbutton_orig_h_pad ("UIButtonOrigHPad", 0);
 	static Params default_params(LLUICtrlFactory::getDefaultParams<LLButton>());
@@ -570,15 +574,13 @@ void LLButton::draw()
 {
 	F32 alpha = mUseDrawContextAlpha ? getDrawContext().mAlpha : getCurrentTransparency();
 	bool flash = FALSE;
-	static LLUICachedControl<F32> button_flash_rate("ButtonFlashRate", 0);
-	static LLUICachedControl<S32> button_flash_count("ButtonFlashCount", 0);
 
 	if( mFlashing )
 	{
 		F32 elapsed = mFlashingTimer.getElapsedTimeF32();
-		S32 flash_count = S32(elapsed * button_flash_rate * 2.f);
+		S32 flash_count = S32(elapsed * mButtonFlashRate * 2.f);
 		// flash on or off?
-		flash = (flash_count % 2 == 0) || flash_count > S32((F32)button_flash_count * 2.f);
+		flash = (flash_count % 2 == 0) || flash_count > S32((F32)mButtonFlashCount * 2.f);
 	}
 
 	bool pressed_by_keyboard = FALSE;
@@ -607,7 +609,7 @@ void LLButton::draw()
 	LLColor4 glow_color = LLColor4::white;
 	LLRender::eBlendType glow_type = LLRender::BT_ADD_WITH_ALPHA;
 	LLUIImage* imagep = NULL;
-	if (pressed)
+	if (pressed && mDisplayPressedState)
 	{
 		imagep = selected ? mImagePressedSelected : mImagePressed;
 	}
@@ -800,7 +802,7 @@ void LLButton::draw()
 		S32 center_y = getLocalRect().getCenterY();
 
 		//FUGLY HACK FOR "DEPRESSED" BUTTONS
-		if (pressed)
+		if (pressed && mDisplayPressedState)
 		{
 			center_y--;
 			center_x++;
@@ -873,7 +875,7 @@ void LLButton::draw()
 
 		S32 y_offset = 2 + (getRect().getHeight() - 20)/2;
 	
-		if (pressed)
+		if (pressed && mDisplayPressedState)
 		{
 			y_offset--;
 			x++;
diff --git a/indra/llui/llbutton.h b/indra/llui/llbutton.h
index 08b45e01b33..14c1d01c7ee 100644
--- a/indra/llui/llbutton.h
+++ b/indra/llui/llbutton.h
@@ -91,7 +91,6 @@ class LLButton
 								label_color_selected,
 								label_color_disabled,
 								label_color_disabled_selected,
-								highlight_color,
 								image_color,
 								image_color_disabled,
 								image_overlay_color,
@@ -120,7 +119,8 @@ class LLButton
 		// misc
 		Optional<bool>			is_toggle,
 								scale_image,
-								commit_on_return;
+								commit_on_return,
+								display_pressed_state;
 		
 		Optional<F32>				hover_glow_amount;
 		Optional<TimeIntervalParam>	held_down_delay;
@@ -131,6 +131,9 @@ class LLButton
 
 		Optional<bool>				handle_right_mouse;
 
+		Optional<S32>				button_flash_count;
+		Optional<F32>				button_flash_rate;
+
 		Params();
 	};
 	
@@ -273,6 +276,9 @@ class LLButton
 	void getOverlayImageSize(S32& overlay_width, S32& overlay_height);
 
 	LLFrameTimer	mMouseDownTimer;
+	bool			mNeedsHighlight;
+	S32				mButtonFlashCount;
+	F32				mButtonFlashRate;
 
 private:
 	void			drawBorder(LLUIImage* imagep, const LLColor4& color, S32 size);
@@ -322,7 +328,6 @@ class LLButton
 	   flash icon name is set in attributes(by default it isn't). First way is used otherwise. */
 	LLPointer<LLUIImage>		mImageFlash;
 
-	LLUIColor					mHighlightColor;
 	LLUIColor					mFlashBgColor;
 
 	LLUIColor					mImageColor;
@@ -355,10 +360,10 @@ class LLButton
 	F32							mHoverGlowStrength;
 	F32							mCurGlowStrength;
 
-	bool						mNeedsHighlight;
 	bool						mCommitOnReturn;
 	bool						mFadeWhenDisabled;
 	bool						mForcePressedState;
+	bool						mDisplayPressedState;
 
 	LLFrameTimer				mFlashingTimer;
 
diff --git a/indra/llui/llfloaterreg.cpp b/indra/llui/llfloaterreg.cpp
index 27e96856b3e..d0ae9413a33 100644
--- a/indra/llui/llfloaterreg.cpp
+++ b/indra/llui/llfloaterreg.cpp
@@ -478,6 +478,7 @@ void LLFloaterReg::toggleToolbarFloaterInstance(const LLSD& sdname)
 	if (LLFloater::isMinimized(instance))
 	{
 		instance->setMinimized(FALSE);
+		instance->setFocus(TRUE);
 	}
 	else if (!LLFloater::isShown(instance))
 	{
@@ -493,6 +494,28 @@ void LLFloaterReg::toggleToolbarFloaterInstance(const LLSD& sdname)
 	}
 }
 
+//static
+bool LLFloaterReg::floaterInstanceOpen(const LLSD& sdname)
+{
+	LLSD key;
+	std::string name = sdname.asString();
+	parse_name_key(name, key);
+
+	bool visible_or_minimized = instanceVisible(name, key);
+
+	if (!visible_or_minimized)
+	{
+		LLFloater* instance = findInstance(name, key); 
+
+		if (instance != NULL)
+		{
+			visible_or_minimized = LLFloater::isMinimized(instance);
+		}
+	}
+
+	return visible_or_minimized;
+}
+
 //static
 bool LLFloaterReg::floaterInstanceVisible(const LLSD& sdname)
 {
diff --git a/indra/llui/llfloaterreg.h b/indra/llui/llfloaterreg.h
index 6239d98a7d7..07ae45cc4c5 100644
--- a/indra/llui/llfloaterreg.h
+++ b/indra/llui/llfloaterreg.h
@@ -128,6 +128,7 @@ class LLFloaterReg
 	static void hideFloaterInstance(const LLSD& sdname);
 	static void toggleFloaterInstance(const LLSD& sdname);
 	static void toggleToolbarFloaterInstance(const LLSD& sdname);
+	static bool floaterInstanceOpen(const LLSD& sdname);
 	static bool floaterInstanceVisible(const LLSD& sdname);
 	static bool floaterInstanceMinimized(const LLSD& sdname);
 	
diff --git a/indra/llui/lltoolbar.cpp b/indra/llui/lltoolbar.cpp
index a544aa9ec7e..0ec2eefc197 100644
--- a/indra/llui/lltoolbar.cpp
+++ b/indra/llui/lltoolbar.cpp
@@ -471,7 +471,33 @@ void LLToolBar::updateLayoutAsNeeded()
 
 void LLToolBar::draw()
 {
-	if (mButtons.empty()) return;
+	if (mButtons.empty())
+	{
+		return;
+	}
+
+	// Update enable/disable state and highlight state for editable toolbars
+	if (!mReadOnly)
+	{
+		for (toolbar_button_list::iterator btn_it = mButtons.begin(); btn_it != mButtons.end(); ++btn_it)
+		{
+			LLToolBarButton* btn = *btn_it;
+			LLCommand* command = LLCommandManager::instance().getCommand(btn->mId);
+
+			if (command && btn->mIsEnabledSignal)
+			{
+				const bool button_command_enabled = (*btn->mIsEnabledSignal)(btn, command->isEnabledParameters());
+				btn->setEnabled(button_command_enabled);
+			}
+
+			if (command && btn->mIsRunningSignal)
+			{
+				const bool button_command_running = (*btn->mIsRunningSignal)(btn, command->isRunningParameters());
+				btn->setFlashing(button_command_running);
+			}
+		}
+	}
+
 	updateLayoutAsNeeded();
 	// rect may have shifted during layout
 	LLUI::popMatrix();
@@ -527,14 +553,47 @@ LLToolBarButton* LLToolBar::createButton(const LLCommandId& id)
 		LLUICtrl::CommitCallbackParam cbParam;
 		cbParam.function_name = commandp->executeFunctionName();
 		cbParam.parameter = commandp->executeParameters();
+
 		button->setCommitCallback(cbParam);
 		button->setStartDragCallback(mStartDragItemCallback);
 		button->setHandleDragCallback(mHandleDragItemCallback);
+
+		const std::string& isEnabledFunction = commandp->isEnabledFunctionName();
+		if (isEnabledFunction.length() > 0)
+		{
+			LLUICtrl::EnableCallbackParam isEnabledParam;
+			isEnabledParam.function_name = isEnabledFunction;
+			isEnabledParam.parameter = commandp->isEnabledParameters();
+			enable_signal_t::slot_type isEnabledCB = initEnableCallback(isEnabledParam);
+
+			if (NULL == button->mIsEnabledSignal)
+			{
+				button->mIsEnabledSignal = new enable_signal_t();
+			}
+
+			button->mIsEnabledSignal->connect(isEnabledCB);
+		}
+
+		const std::string& isRunningFunction = commandp->isRunningFunctionName();
+		if (isRunningFunction.length() > 0)
+		{
+			LLUICtrl::EnableCallbackParam isRunningParam;
+			isRunningParam.function_name = isRunningFunction;
+			isRunningParam.parameter = commandp->isRunningParameters();
+			enable_signal_t::slot_type isRunningCB = initEnableCallback(isRunningParam);
+
+			if (NULL == button->mIsRunningSignal)
+			{
+				button->mIsRunningSignal = new enable_signal_t();
+			}
+
+			button->mIsRunningSignal->connect(isRunningCB);
+		}
 	}
 
 	button->setCommandId(id);
-	return button;
 
+	return button;
 }
 
 BOOL LLToolBar::handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop,
@@ -568,9 +627,22 @@ LLToolBarButton::LLToolBarButton(const Params& p)
 	mMouseDownY(0),
 	mWidthRange(p.button_width),
 	mDesiredHeight(p.desired_height),
-	mId("")
+	mId(""),
+	mIsEnabledSignal(NULL),
+	mIsRunningSignal(NULL),
+	mIsStartingSignal(NULL)
 {
 	mUUID = LLUUID::generateNewID(p.name);
+
+	mButtonFlashRate = 0.0;
+	mButtonFlashCount = 0;
+}
+
+LLToolBarButton::~LLToolBarButton()
+{
+	delete mIsEnabledSignal;
+	delete mIsRunningSignal;
+	delete mIsStartingSignal;
 }
 
 BOOL LLToolBarButton::handleMouseDown(S32 x, S32 y, MASK mask)
@@ -594,10 +666,10 @@ BOOL LLToolBarButton::handleHover(S32 x, S32 y, MASK mask)
 			handled = TRUE;
 		}
 		else 
-			{
+		{
 			handled = mHandleDragItemCallback(x,y,mUUID,LLAssetType::AT_WIDGET);
-			}
 		}
+	}
 	else
 	{
 		handled = LLButton::handleHover(x, y, mask);
@@ -605,3 +677,10 @@ BOOL LLToolBarButton::handleHover(S32 x, S32 y, MASK mask)
 	return handled;
 }
 
+void LLToolBarButton::onMouseEnter(S32 x, S32 y, MASK mask)
+{
+	LLUICtrl::onMouseEnter(x, y, mask);
+
+	// Always highlight toolbar buttons, even if they are disabled
+	mNeedsHighlight = TRUE;
+}
diff --git a/indra/llui/lltoolbar.h b/indra/llui/lltoolbar.h
index 3c317e10a2b..b649ab28ff4 100644
--- a/indra/llui/lltoolbar.h
+++ b/indra/llui/lltoolbar.h
@@ -56,6 +56,7 @@ class LLToolBarButton : public LLButton
 	};
 
 	LLToolBarButton(const Params& p);
+	~LLToolBarButton();
 
 	BOOL handleMouseDown(S32 x, S32 y, MASK mask);
 	BOOL handleHover(S32 x, S32 y, MASK mask);
@@ -63,6 +64,9 @@ class LLToolBarButton : public LLButton
 
 	void setStartDragCallback(startdrag_callback_t cb) { mStartDragItemCallback = cb; }
 	void setHandleDragCallback(handledrag_callback_t cb) { mHandleDragItemCallback = cb; }
+
+	void onMouseEnter(S32 x, S32 y, MASK mask);
+
 private:
 	LLCommandId		mId;
 	S32				mMouseDownX;
@@ -73,6 +77,10 @@ class LLToolBarButton : public LLButton
 	startdrag_callback_t		mStartDragItemCallback;
 	handledrag_callback_t		mHandleDragItemCallback;
 	LLUUID						mUUID;
+
+	enable_signal_t*	mIsEnabledSignal;
+	enable_signal_t*	mIsRunningSignal;
+	enable_signal_t*	mIsStartingSignal;
 };
 
 
@@ -153,6 +161,7 @@ class LLToolBar
 	bool addCommand(const LLCommandId& commandId);
 	bool hasCommand(const LLCommandId& commandId) const;
 	bool enableCommand(const LLCommandId& commandId, bool enabled);
+
 	void setStartDragCallback(startdrag_callback_t cb) { mStartDragItemCallback = cb; }
 	void setHandleDragCallback(handledrag_callback_t cb) { mHandleDragItemCallback = cb; }
 	void setHandleDropCallback(handledrop_callback_t cb) { mHandleDropCallback = cb; }
@@ -188,7 +197,8 @@ class LLToolBar
 	LLUUID							mUUID;
 	const bool						mReadOnly;
 
-	std::list<LLToolBarButton*>		mButtons;
+	typedef std::list<LLToolBarButton*> toolbar_button_list;
+	toolbar_button_list				mButtons;
 	command_id_list_t				mButtonCommands;
 	typedef std::map<LLCommandId, LLToolBarButton*> command_id_map;
 	command_id_map					mButtonMap;
diff --git a/indra/llui/llui.cpp b/indra/llui/llui.cpp
index 76a12e649b4..9c0253f0743 100644
--- a/indra/llui/llui.cpp
+++ b/indra/llui/llui.cpp
@@ -1637,6 +1637,7 @@ void LLUI::initClass(const settings_map_t& settings,
 	
 	// Used by menus along with Floater.Toggle to display visibility as a checkmark
 	LLUICtrl::EnableCallbackRegistry::defaultRegistrar().add("Floater.Visible", boost::bind(&LLFloaterReg::floaterInstanceVisible, _2));
+	LLUICtrl::EnableCallbackRegistry::defaultRegistrar().add("Floater.IsOpen", boost::bind(&LLFloaterReg::floaterInstanceOpen, _2));
 
 	// Parse the master list of commands
 	LLCommandManager::load();
diff --git a/indra/newview/app_settings/commands.xml b/indra/newview/app_settings/commands.xml
index 3a91ef490d7..1fff95417b3 100644
--- a/indra/newview/app_settings/commands.xml
+++ b/indra/newview/app_settings/commands.xml
@@ -7,6 +7,8 @@
            tooltip_ref="Command_AboutLand_Tooltip"
            execute_function="Floater.ToolbarToggle"
            execute_parameters="about_land"
+           is_running_function="Floater.IsOpen"
+           is_running_parameters="about_land"
            />
   <command name="appearance"
            available_in_toybox="true"
@@ -15,6 +17,8 @@
            tooltip_ref="Command_Appearance_Tooltip"
            execute_function="Floater.ToolbarToggle"
            execute_parameters="appearance"
+           is_running_function="Floater.IsOpen"
+           is_running_parameters="appearance"
            />
   <command name="avatar"
            available_in_toybox="true"
@@ -23,6 +27,8 @@
            tooltip_ref="Command_Avatar_Tooltip"
            execute_function="Floater.ToolbarToggle"
            execute_parameters="avatar_picker"
+           is_running_function="Floater.IsOpen"
+           is_running_parameters="avatar_picker"
            />
   <command name="build"
            available_in_toybox="true"
@@ -31,6 +37,8 @@
            tooltip_ref="Command_Build_Tooltip"
            execute_function="Floater.ToolbarToggle"
            execute_parameters="build"
+           is_running_function="Floater.IsOpen"
+           is_running_parameters="build"
            />
   <command name="chat"
            available_in_toybox="true"
@@ -39,6 +47,8 @@
            tooltip_ref="Command_Chat_Tooltip"
            execute_function="Floater.ToolbarToggle"
            execute_parameters="chat_bar"
+           is_running_function="Floater.IsOpen"
+           is_running_parameters="chat_bar"
            />
   <command name="compass"
            available_in_toybox="false"
@@ -47,6 +57,8 @@
            tooltip_ref="Command_Compass_Tooltip"
            execute_function="Floater.ToolbarToggle"
            execute_parameters="compass"
+           is_running_function="Floater.IsOpen"
+           is_running_parameters="compass"
            />
   <command name="destinations"
            available_in_toybox="true"
@@ -55,6 +67,8 @@
            tooltip_ref="Command_Destinations_Tooltip"
            execute_function="Floater.ToolbarToggle"
            execute_parameters="destinations"
+           is_running_function="Floater.IsOpen"
+           is_running_parameters="destinations"
            />
   <command name="gestures"
            available_in_toybox="true"
@@ -63,6 +77,8 @@
            tooltip_ref="Command_Gestures_Tooltip"
            execute_function="Floater.ToolbarToggle"
            execute_parameters="gestures"
+           is_running_function="Floater.IsOpen"
+           is_running_parameters="gestures"
            />
   <command name="howto"
            available_in_toybox="true"
@@ -71,6 +87,8 @@
            tooltip_ref="Command_HowTo_Tooltip"
            execute_function="Floater.ToolbarToggle"
            execute_parameters="help_browser"
+           is_running_function="Floater.IsOpen"
+           is_running_parameters="help_browser"
            />
   <command name="inventory"
            available_in_toybox="true"
@@ -79,6 +97,8 @@
            tooltip_ref="Command_Inventory_Tooltip"
            execute_function="Floater.ToolbarToggle"
            execute_parameters="inventory"
+           is_running_function="Floater.IsOpen"
+           is_running_parameters="inventory"
            />
   <command name="map"
            available_in_toybox="true"
@@ -87,6 +107,8 @@
            tooltip_ref="Command_Map_Tooltip"
            execute_function="Floater.ToolbarToggle"
            execute_parameters="world_map"
+           is_running_function="Floater.IsOpen"
+           is_running_parameters="world_map"
            />
   <command name="marketplace"
            available_in_toybox="true"
@@ -95,6 +117,8 @@
            tooltip_ref="Command_Marketplace_Tooltip"
            execute_function="Floater.ToolbarToggle"
            execute_parameters="marketplace"
+           is_running_function="Floater.IsOpen"
+           is_running_parameters="marketplace"
            />
   <command name="minimap"
            available_in_toybox="true"
@@ -103,6 +127,8 @@
            tooltip_ref="Command_MiniMap_Tooltip"
            execute_function="Floater.ToolbarToggle"
            execute_parameters="mini_map"
+           is_running_function="Floater.IsOpen"
+           is_running_parameters="mini_map"
            />
   <command name="move"
            available_in_toybox="true"
@@ -111,6 +137,8 @@
            tooltip_ref="Command_Move_Tooltip"
            execute_function="Floater.ToolbarToggle"
            execute_parameters="moveview"
+           is_running_function="Floater.IsOpen"
+           is_running_parameters="moveview"
            />
   <command name="people"
            available_in_toybox="true"
@@ -119,6 +147,8 @@
            tooltip_ref="Command_People_Tooltip"
            execute_function="Floater.ToolbarToggle"
            execute_parameters="people"
+           is_running_function="Floater.IsOpen"
+           is_running_parameters="people"
            />
   <command name="places"
            available_in_toybox="true"
@@ -127,6 +157,8 @@
            tooltip_ref="Command_Places_Tooltip"
            execute_function="Floater.ToolbarToggle"
            execute_parameters="places"
+           is_running_function="Floater.IsOpen"
+           is_running_parameters="places"
            />
   <command name="preferences"
            available_in_toybox="true"
@@ -135,6 +167,8 @@
            tooltip_ref="Command_Preferences_Tooltip"
            execute_function="Floater.ToolbarToggle"
            execute_parameters="preferences"
+           is_running_function="Floater.IsOpen"
+           is_running_parameters="preferences"
            />
   <command name="profile"
            available_in_toybox="true"
@@ -143,6 +177,8 @@
            tooltip_ref="Command_Profile_Tooltip"
            execute_function="Floater.ToolbarToggle"
            execute_parameters="my_profile"
+           is_running_function="Floater.IsOpen"
+           is_running_parameters="my_profile"
            />
   <command name="search"
            available_in_toybox="true"
@@ -151,6 +187,8 @@
            tooltip_ref="Command_Search_Tooltip"
            execute_function="Floater.ToolbarToggle"
            execute_parameters="search"
+           is_running_function="Floater.IsOpen"
+           is_running_parameters="search"
            />
   <command name="snapshot"
            available_in_toybox="true"
@@ -159,6 +197,8 @@
            tooltip_ref="Command_Snapshot_Tooltip"
            execute_function="Floater.ToolbarToggle"
            execute_parameters="snapshot"
+           is_running_function="Floater.IsOpen"
+           is_running_parameters="snapshot"
            />
   <command name="speak"
            available_in_toybox="true"
@@ -167,6 +207,8 @@
            tooltip_ref="Command_Speak_Tooltip"
            execute_function="Floater.ToolbarToggle"
            execute_parameters="speak"
+           is_running_function="Floater.IsOpen"
+           is_running_parameters="speak"
            />
   <command name="view"
            available_in_toybox="true"
@@ -175,6 +217,8 @@
            tooltip_ref="Command_View_Tooltip"
            execute_function="Floater.ToolbarToggle"
            execute_parameters="camera"
+           is_running_function="Floater.IsOpen"
+           is_running_parameters="camera"
            />
   <command name="voice"
            available_in_toybox="true"
@@ -183,5 +227,7 @@
            tooltip_ref="Command_Voice_Tooltip"
            execute_function="Floater.ToolbarToggle"
            execute_parameters="voice_controls"
+           is_running_function="Floater.IsOpen"
+           is_running_parameters="voice_controls"
            />
 </commands>
diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml
index 07799d4eee0..0da20b15ed1 100644
--- a/indra/newview/app_settings/settings.xml
+++ b/indra/newview/app_settings/settings.xml
@@ -1150,28 +1150,6 @@
       <key>Value</key>
       <integer>0</integer>
     </map>
-    <key>ButtonFlashCount</key>
-    <map>
-      <key>Comment</key>
-      <string>Number of flashes after which flashing buttons stay lit up</string>
-      <key>Persist</key>
-      <integer>1</integer>
-      <key>Type</key>
-      <string>S32</string>
-      <key>Value</key>
-      <integer>8</integer>
-    </map>
-    <key>ButtonFlashRate</key>
-    <map>
-      <key>Comment</key>
-      <string>Frequency at which buttons flash (hz)</string>
-      <key>Persist</key>
-      <integer>1</integer>
-      <key>Type</key>
-      <string>F32</string>
-      <key>Value</key>
-      <real>1.25</real>
-    </map>
     <key>ButtonHPad</key>
     <map>
       <key>Comment</key>
diff --git a/indra/newview/skins/default/xui/en/floater_test_button.xml b/indra/newview/skins/default/xui/en/floater_test_button.xml
index bf0a774e766..9bc05107a20 100644
--- a/indra/newview/skins/default/xui/en/floater_test_button.xml
+++ b/indra/newview/skins/default/xui/en/floater_test_button.xml
@@ -78,7 +78,6 @@
     <button
      bottom_delta="30"
      height="23"
-     highlight_color="EmphasisColor"
      label="Highlight"
      layout="topleft"
      name="highlight_color_button" />
diff --git a/indra/newview/skins/default/xui/en/floater_toybox.xml b/indra/newview/skins/default/xui/en/floater_toybox.xml
index 972ae1487ae..5c6fa5bc865 100644
--- a/indra/newview/skins/default/xui/en/floater_toybox.xml
+++ b/indra/newview/skins/default/xui/en/floater_toybox.xml
@@ -61,6 +61,19 @@
     side="top"
     top="85">
     <button_panel background_visible="false" />
+    <button_icon_and_text image_unselected="PushButton_Off"
+                          image_selected="PushButton_Off"
+                          image_disabled_selected="PushButton_Disabled"
+                          image_disabled="PushButton_Disabled"
+                          label_color="ButtonLabelColor"
+                          label_color_selected="ButtonLabelColor"
+                          label_color_disabled="ButtonLabelDisabledColor"
+                          label_color_disabled_selected="ButtonLabelDisabledColor"
+                          image_color="ButtonImageColor"
+                          image_color_disabled="ButtonImageColor"
+                          flash_color="ButtonUnselectedFgColor"
+                          hover_glow_amount="0.15"
+                          display_pressed_state="false" />
   </toolbar>
   <panel
     bevel_style="none"
diff --git a/indra/newview/skins/default/xui/en/widgets/button.xml b/indra/newview/skins/default/xui/en/widgets/button.xml
index 61d36468d74..e2baba92a3a 100644
--- a/indra/newview/skins/default/xui/en/widgets/button.xml
+++ b/indra/newview/skins/default/xui/en/widgets/button.xml
@@ -15,7 +15,6 @@
         label_color_selected="ButtonLabelSelectedColor"
         label_color_disabled="ButtonLabelDisabledColor"
         label_color_disabled_selected="ButtonLabelSelectedDisabledColor"
-        highlight_color="ButtonUnselectedFgColor"
         image_color="ButtonImageColor"
         image_color_disabled="ButtonImageColor"
         flash_color="ButtonFlashBgColor"
@@ -27,5 +26,9 @@
         scale_image="true"
         handle_right_mouse="true"
         use_draw_context_alpha="true"
-        held_down_delay.seconds="0.5">
+        held_down_delay.seconds="0.5"
+        button_flash_count="8"
+        button_flash_rate="1.25"
+        display_pressed_state="true"
+        >
 </button>
diff --git a/indra/newview/skins/default/xui/en/widgets/toolbar.xml b/indra/newview/skins/default/xui/en/widgets/toolbar.xml
index 0c7e7cff564..15851661146 100644
--- a/indra/newview/skins/default/xui/en/widgets/toolbar.xml
+++ b/indra/newview/skins/default/xui/en/widgets/toolbar.xml
@@ -21,7 +21,8 @@
                         chrome="true"
                         image_overlay_alignment="left"
                         use_ellipses="true"
-                        auto_resize="true"/>
+                        auto_resize="true"
+                        flash_color="EmphasisColor"/>
   <button_icon pad_left="10"
                pad_right="10"
                desired_height="35"
@@ -31,5 +32,6 @@
                label=""
                chrome="true"
                use_ellipses="true"
-               auto_resize="true"/>
+               auto_resize="true"
+               flash_color="EmphasisColor"/>
 </toolbar>
-- 
GitLab