From af4329dbdabff4eb2bf7b93d42f44334f00904ea Mon Sep 17 00:00:00 2001
From: andreykproductengine <andreykproductengine@lindenlab.com>
Date: Thu, 1 Aug 2019 20:29:33 +0300
Subject: SL-11666 Fixed the search menu button being over Linden dollar
 balance

---
 indra/newview/llstatusbar.cpp | 35 +++++++++++++++++++++++------------
 indra/newview/llstatusbar.h   |  3 ++-
 2 files changed, 25 insertions(+), 13 deletions(-)

(limited to 'indra/newview')

diff --git a/indra/newview/llstatusbar.cpp b/indra/newview/llstatusbar.cpp
index f3c270a97b..c4e09b6767 100644
--- a/indra/newview/llstatusbar.cpp
+++ b/indra/newview/llstatusbar.cpp
@@ -243,16 +243,24 @@ BOOL LLStatusBar::postBuild()
 	mPanelNearByMedia->setFollows(FOLLOWS_TOP|FOLLOWS_RIGHT);
 	mPanelNearByMedia->setVisible(FALSE);
 
+	updateBalancePanelPosition();
+
 	// Hook up and init for filtering
 	mFilterEdit = getChild<LLSearchEditor>( "search_menu_edit" );
 	mSearchPanel = getChild<LLPanel>( "menu_search_panel" );
 
-	mSearchPanel->setVisible(gSavedSettings.getBOOL("MenuSearch"));
+	BOOL search_panel_visible = gSavedSettings.getBOOL("MenuSearch");
+	mSearchPanel->setVisible(search_panel_visible);
 	mFilterEdit->setKeystrokeCallback(boost::bind(&LLStatusBar::onUpdateFilterTerm, this));
 	mFilterEdit->setCommitCallback(boost::bind(&LLStatusBar::onUpdateFilterTerm, this));
 	collectSearchableItems();
 	gSavedSettings.getControl("MenuSearch")->getCommitSignal()->connect(boost::bind(&LLStatusBar::updateMenuSearchVisibility, this, _2));
 
+	if (search_panel_visible)
+	{
+		updateMenuSearchPosition();
+	}
+
 	return TRUE;
 }
 
@@ -361,17 +369,7 @@ void LLStatusBar::setBalance(S32 balance)
 	std::string label_str = getString("buycurrencylabel", string_args);
 	mBoxBalance->setValue(label_str);
 
-	// Resize the L$ balance background to be wide enough for your balance plus the buy button
-	{
-		const S32 HPAD = 24;
-		LLRect balance_rect = mBoxBalance->getTextBoundingRect();
-		LLRect buy_rect = getChildView("buyL")->getRect();
-		LLRect shop_rect = getChildView("goShop")->getRect();
-		LLView* balance_bg_view = getChildView("balance_bg");
-		LLRect balance_bg_rect = balance_bg_view->getRect();
-		balance_bg_rect.mLeft = balance_bg_rect.mRight - (buy_rect.getWidth() + shop_rect.getWidth() + balance_rect.getWidth() + HPAD);
-		balance_bg_view->setShape(balance_bg_rect);
-	}
+	updateBalancePanelPosition();
 
 	// If the search panel is shown, move this according to the new balance width. Parcel text will reshape itself in setParcelInfoText
 	if (mSearchPanel && mSearchPanel->getVisible())
@@ -659,6 +657,19 @@ void LLStatusBar::updateMenuSearchPosition()
 	mSearchPanel->setShape( searchRect );
 }
 
+void LLStatusBar::updateBalancePanelPosition()
+{
+    // Resize the L$ balance background to be wide enough for your balance plus the buy button
+    const S32 HPAD = 24;
+    LLRect balance_rect = mBoxBalance->getTextBoundingRect();
+    LLRect buy_rect = getChildView("buyL")->getRect();
+    LLRect shop_rect = getChildView("goShop")->getRect();
+    LLView* balance_bg_view = getChildView("balance_bg");
+    LLRect balance_bg_rect = balance_bg_view->getRect();
+    balance_bg_rect.mLeft = balance_bg_rect.mRight - (buy_rect.getWidth() + shop_rect.getWidth() + balance_rect.getWidth() + HPAD);
+    balance_bg_view->setShape(balance_bg_rect);
+}
+
 
 // Implements secondlife:///app/balance/request to request a L$ balance
 // update via UDP message system. JC
diff --git a/indra/newview/llstatusbar.h b/indra/newview/llstatusbar.h
index 403d590aca..cad877f799 100644
--- a/indra/newview/llstatusbar.h
+++ b/indra/newview/llstatusbar.h
@@ -114,7 +114,8 @@ private:
 	std::unique_ptr< ll::statusbar::SearchData > mSearchData;
 	void collectSearchableItems();
 	void updateMenuSearchVisibility( const LLSD& data );
-	void updateMenuSearchPosition();
+	void updateMenuSearchPosition(); // depends onto balance position
+	void updateBalancePanelPosition();
 
 private:
 	LLTextBox	*mTextTime;
-- 
cgit v1.2.3