diff options
author | Graham Linden <graham@lindenlab.com> | 2019-05-08 10:37:34 -0700 |
---|---|---|
committer | Graham Linden <graham@lindenlab.com> | 2019-05-08 10:37:34 -0700 |
commit | 65cb4b6d20b52ffebdc93e0e19f99520f6364dde (patch) | |
tree | d2b6ff74ce2d40f5de91b95fe7b5e21701d6e181 /indra/newview/llstatusbar.cpp | |
parent | f14888b6166f91533e778e94701b74a9639ebefd (diff) | |
parent | 34322f8f37380df868703051230f2a4109602b3f (diff) |
Merge 6.2.2
Diffstat (limited to 'indra/newview/llstatusbar.cpp')
-rw-r--r-- | indra/newview/llstatusbar.cpp | 92 |
1 files changed, 91 insertions, 1 deletions
diff --git a/indra/newview/llstatusbar.cpp b/indra/newview/llstatusbar.cpp index 398ec953d7..efc57ced34 100644 --- a/indra/newview/llstatusbar.cpp +++ b/indra/newview/llstatusbar.cpp @@ -82,6 +82,8 @@ #include "llparcel.h" #include "llstring.h" #include "message.h" +#include "llsearchableui.h" +#include "llsearcheditor.h" // system includes #include <iomanip> @@ -114,7 +116,9 @@ LLStatusBar::LLStatusBar(const LLRect& rect) mBalance(0), mHealth(100), mSquareMetersCredit(0), - mSquareMetersCommitted(0) + mSquareMetersCommitted(0), + mFilterEdit(NULL), // Edit for filtering + mSearchPanel(NULL) // Panel for filtering { setRect(rect); @@ -248,6 +252,16 @@ BOOL LLStatusBar::postBuild() mPanelNearByMedia->setFollows(FOLLOWS_TOP|FOLLOWS_RIGHT); mPanelNearByMedia->setVisible(FALSE); + // Hook up and init for filtering + mFilterEdit = getChild<LLSearchEditor>( "search_menu_edit" ); + mSearchPanel = getChild<LLPanel>( "menu_search_panel" ); + + mSearchPanel->setVisible(gSavedSettings.getBOOL("MenuSearch")); + 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)); + return TRUE; } @@ -327,6 +341,7 @@ void LLStatusBar::setVisibleForMouselook(bool visible) mMediaToggle->setVisible(visible); mSGBandwidth->setVisible(visible); mSGPacketLoss->setVisible(visible); + mSearchPanel->setVisible(visible && gSavedSettings.getBOOL("MenuSearch")); setBackgroundVisible(visible); mIconPresetsCamera->setVisible(visible); mIconPresetsGraphic->setVisible(visible); @@ -368,6 +383,12 @@ void LLStatusBar::setBalance(S32 balance) balance_bg_view->setShape(balance_bg_rect); } + // 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()) + { + updateMenuSearchPosition(); + } + if (mBalance && (fabs((F32)(mBalance - balance)) > gSavedSettings.getF32("UISndMoneyChangeThreshold"))) { if (mBalance > balance) @@ -606,6 +627,75 @@ void LLStatusBar::onVolumeChanged(const LLSD& newvalue) refresh(); } +void LLStatusBar::onUpdateFilterTerm() +{ + LLWString searchValue = utf8str_to_wstring( mFilterEdit->getValue() ); + LLWStringUtil::toLower( searchValue ); + + if( !mSearchData || mSearchData->mLastFilter == searchValue ) + return; + + mSearchData->mLastFilter = searchValue; + + mSearchData->mRootMenu->hightlightAndHide( searchValue ); + gMenuBarView->needsArrange(); +} + +void collectChildren( LLMenuGL *aMenu, ll::statusbar::SearchableItemPtr aParentMenu ) +{ + for( U32 i = 0; i < aMenu->getItemCount(); ++i ) + { + LLMenuItemGL *pMenu = aMenu->getItem( i ); + + ll::statusbar::SearchableItemPtr pItem( new ll::statusbar::SearchableItem ); + pItem->mCtrl = pMenu; + pItem->mMenu = pMenu; + pItem->mLabel = utf8str_to_wstring( pMenu->ll::ui::SearchableControl::getSearchText() ); + LLWStringUtil::toLower( pItem->mLabel ); + aParentMenu->mChildren.push_back( pItem ); + + LLMenuItemBranchGL *pBranch = dynamic_cast< LLMenuItemBranchGL* >( pMenu ); + if( pBranch ) + collectChildren( pBranch->getBranch(), pItem ); + } + +} + +void LLStatusBar::collectSearchableItems() +{ + mSearchData.reset( new ll::statusbar::SearchData ); + ll::statusbar::SearchableItemPtr pItem( new ll::statusbar::SearchableItem ); + mSearchData->mRootMenu = pItem; + collectChildren( gMenuBarView, pItem ); +} + +void LLStatusBar::updateMenuSearchVisibility(const LLSD& data) +{ + bool visible = data.asBoolean(); + mSearchPanel->setVisible(visible); + if (!visible) + { + mFilterEdit->setText(LLStringUtil::null); + onUpdateFilterTerm(); + } + else + { + updateMenuSearchPosition(); + } +} + +void LLStatusBar::updateMenuSearchPosition() +{ + const S32 HPAD = 12; + LLRect balanceRect = getChildView("balance_bg")->getRect(); + LLRect searchRect = mSearchPanel->getRect(); + S32 w = searchRect.getWidth(); + searchRect.mLeft = balanceRect.mLeft - w - HPAD; + searchRect.mRight = searchRect.mLeft + w; + mSearchPanel->setShape( searchRect ); +} + + // Implements secondlife:///app/balance/request to request a L$ balance // update via UDP message system. JC class LLBalanceHandler : public LLCommandHandler |