diff options
| author | AndreyL ProductEngine <alihatskiy@productengine.com> | 2019-01-03 22:59:49 +0200 | 
|---|---|---|
| committer | AndreyL ProductEngine <alihatskiy@productengine.com> | 2019-01-03 22:59:49 +0200 | 
| commit | 09b750483a2cde7ea3c80a0238f3224a2cf1cb70 (patch) | |
| tree | 5f9b38b93f916c820cf9308ed689701790b3eef5 /indra/llui | |
| parent | ab428e194eaa144e8dcecc353c3c7ed83d6cee3e (diff) | |
SL-10293 Firestorm PR: preferences and menu search
Diffstat (limited to 'indra/llui')
| -rw-r--r-- | indra/llui/CMakeLists.txt | 1 | ||||
| -rw-r--r-- | indra/llui/llbutton.cpp | 4 | ||||
| -rw-r--r-- | indra/llui/llbutton.h | 7 | ||||
| -rw-r--r-- | indra/llui/llcheckboxctrl.h | 13 | ||||
| -rw-r--r-- | indra/llui/llmenugl.cpp | 4 | ||||
| -rw-r--r-- | indra/llui/llmenugl.h | 9 | ||||
| -rw-r--r-- | indra/llui/llsearchablecontrol.h | 71 | ||||
| -rw-r--r-- | indra/llui/llsliderctrl.h | 15 | ||||
| -rw-r--r-- | indra/llui/lltabcontainer.cpp | 50 | ||||
| -rw-r--r-- | indra/llui/lltabcontainer.h | 2 | ||||
| -rw-r--r-- | indra/llui/lltextbase.cpp | 11 | ||||
| -rw-r--r-- | indra/llui/lltextbase.h | 8 | ||||
| -rw-r--r-- | indra/llui/lluictrl.h | 1 | 
13 files changed, 189 insertions, 7 deletions
| diff --git a/indra/llui/CMakeLists.txt b/indra/llui/CMakeLists.txt index 8054eb3619..e44f57fa9f 100644 --- a/indra/llui/CMakeLists.txt +++ b/indra/llui/CMakeLists.txt @@ -200,6 +200,7 @@ set(llui_HEADER_FILES      llresizehandle.h      llresmgr.h      llrngwriter.h +    llsearchablecontrol.h      llsearcheditor.h       llscrollbar.h      llscrollcontainer.h diff --git a/indra/llui/llbutton.cpp b/indra/llui/llbutton.cpp index 510a2537b9..6b7a8a8b86 100644 --- a/indra/llui/llbutton.cpp +++ b/indra/llui/llbutton.cpp @@ -769,6 +769,10 @@ void LLButton::draw()  		}  	} +	// Highlight if needed +	if( ll::ui::SearchableControl::getHighlighted() ) +		label_color = ll::ui::SearchableControl::getHighlightColor(); +  	// Unselected label assignments  	LLWString label = getCurrentLabel(); diff --git a/indra/llui/llbutton.h b/indra/llui/llbutton.h index 7b4719866d..7629ed1fea 100644 --- a/indra/llui/llbutton.h +++ b/indra/llui/llbutton.h @@ -62,6 +62,7 @@ class LLUICtrlFactory;  class LLButton  : public LLUICtrl, public LLBadgeOwner +, public ll::ui::SearchableControl  {  public:  	struct Params  @@ -380,6 +381,12 @@ protected:  	LLFlashTimer *				mFlashingTimer;  	bool                        mForceFlashing; // Stick flashing color even if button is pressed  	bool						mHandleRightMouse; + +protected: +	virtual std::string _getSearchText() const +	{ +		return getLabelUnselected() + getToolTip(); +	}  };  // Build time optimization, generate once in .cpp file diff --git a/indra/llui/llcheckboxctrl.h b/indra/llui/llcheckboxctrl.h index 71bdc32e66..07ae9c3b18 100644 --- a/indra/llui/llcheckboxctrl.h +++ b/indra/llui/llcheckboxctrl.h @@ -47,6 +47,7 @@ class LLViewBorder;  class LLCheckBoxCtrl  : public LLUICtrl +, public ll::ui::SearchableControl  {  public:  	struct Params  @@ -109,6 +110,18 @@ public:  	virtual void		resetDirty();			// Clear dirty state  protected: +	virtual std::string _getSearchText() const +	{ +		return getLabel() + getToolTip(); +	} + +	virtual void onSetHighlight() const // When highlight, really do highlight the label +	{ +		if( mLabel ) +			mLabel->ll::ui::SearchableControl::setHighlighted( ll::ui::SearchableControl::getHighlighted() ); +	} + +protected:  	// note: value is stored in toggle state of button  	LLButton*		mButton;  	LLTextBox*		mLabel; diff --git a/indra/llui/llmenugl.cpp b/indra/llui/llmenugl.cpp index 0d42f726fa..92543b952e 100644 --- a/indra/llui/llmenugl.cpp +++ b/indra/llui/llmenugl.cpp @@ -504,6 +504,10 @@ void LLMenuItemGL::draw( void )  		color = mDisabledColor.get();  	} +	// Highlight if needed +	if( ll::ui::SearchableControl::getHighlighted() ) +		color = ll::ui::SearchableControl::getHighlightColor(); +  	// Draw the text on top.  	if (mBriefItem)  	{ diff --git a/indra/llui/llmenugl.h b/indra/llui/llmenugl.h index 69f7d21513..78f688642e 100644 --- a/indra/llui/llmenugl.h +++ b/indra/llui/llmenugl.h @@ -48,7 +48,7 @@ extern S32 MENU_BAR_WIDTH;  // The LLMenuItemGL represents a single menu item in a menu.   //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -class LLMenuItemGL : public LLUICtrl +class LLMenuItemGL: public LLUICtrl, public ll::ui::SearchableControl  {  public:  	struct Params : public LLInitParam::Block<Params, LLUICtrl::Params> @@ -175,7 +175,12 @@ protected:  	// This function appends the character string representation of  	// the current accelerator key and mask to the provided string.  	void appendAcceleratorString( std::string& st ) const; -		 + +	virtual std::string _getSearchText() const +	{ +		return mLabel.getString(); +	} +  protected:  	KEY mAcceleratorKey;  	MASK mAcceleratorMask; diff --git a/indra/llui/llsearchablecontrol.h b/indra/llui/llsearchablecontrol.h new file mode 100644 index 0000000000..f7f1ffa0a5 --- /dev/null +++ b/indra/llui/llsearchablecontrol.h @@ -0,0 +1,71 @@ +/** +* @file llsearchablecontrol.h +* +* $LicenseInfo:firstyear=2019&license=viewerlgpl$ +* Second Life Viewer Source Code +* Copyright (C) 2019, Linden Research, Inc. +* +* This library is free software; you can redistribute it and/or +* modify it under the terms of the GNU Lesser General Public +* License as published by the Free Software Foundation; +* version 2.1 of the License only. +* +* This library is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU +* Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser General Public +* License along with this library; if not, write to the Free Software +* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA +* +* Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA +* $/LicenseInfo$ +*/ + +#ifndef LL_SEARCHABLE_CONTROL_H +#define LL_SEARCHABLE_CONTROL_H + +#include "lluicolortable.h" +#include "lluicolor.h" + +namespace ll +{ +	namespace ui +	{ +		class SearchableControl +		{ +			mutable bool mIsHighlighed; +		public: +			SearchableControl() +				: mIsHighlighed( false ) +			{ } +			virtual ~SearchableControl() +			{ } + +			LLColor4 getHighlightColor( ) const +			{ +				static LLUIColor highlight_color = LLUIColorTable::instance().getColor("SearchableControlHighlightColor", LLColor4::red); +				return highlight_color.get(); +			} + +			void setHighlighted( bool aVal ) const +			{ +				mIsHighlighed = aVal; +				onSetHighlight( ); +			} +			bool getHighlighted( ) const +			{ return mIsHighlighed; } + +			std::string getSearchText() const +			{ return _getSearchText(); }  +		protected: +			virtual std::string _getSearchText() const = 0; +			virtual void onSetHighlight( ) const +			{ } +		}; +	} +} + + +#endif diff --git a/indra/llui/llsliderctrl.h b/indra/llui/llsliderctrl.h index 67cca9ef04..2bb8668b90 100644 --- a/indra/llui/llsliderctrl.h +++ b/indra/llui/llsliderctrl.h @@ -35,7 +35,7 @@  #include "lllineeditor.h" -class LLSliderCtrl : public LLF32UICtrl +class LLSliderCtrl: public LLF32UICtrl, public ll::ui::SearchableControl  {  public:  	struct Params : public LLInitParam::Block<Params, LLF32UICtrl::Params> @@ -131,6 +131,19 @@ public:  	static void		onEditorGainFocus(LLFocusableElement* caller, void *userdata);  	static void		onEditorChangeFocus(LLUICtrl* caller, S32 direction, void *userdata); +protected: +	virtual std::string _getSearchText() const +	{ +		std::string strLabel; +		if( mLabelBox ) +			strLabel = mLabelBox->getLabel(); +		return strLabel + getToolTip(); +	} +	virtual void onSetHighlight() const  // When highlight, really do highlight the label +	{ +		if( mLabelBox ) +			mLabelBox->ll::ui::SearchableControl::setHighlighted( ll::ui::SearchableControl::getHighlighted() ); +	}  private:  	void			updateText();  	void			reportInvalidData(); diff --git a/indra/llui/lltabcontainer.cpp b/indra/llui/lltabcontainer.cpp index 1b2f09cff5..9c8636f936 100644 --- a/indra/llui/lltabcontainer.cpp +++ b/indra/llui/lltabcontainer.cpp @@ -76,7 +76,8 @@ public:  		mButton(b),  		mOldState(FALSE),  		mPlaceholderText(placeholder), -		mPadding(0) +		mPadding(0), +		mVisible(true)  	{}  	LLTabContainer*  mTabContainer; @@ -85,6 +86,8 @@ public:  	BOOL			 mOldState;  	LLTextBox*		 mPlaceholderText;  	S32				 mPadding; + +	mutable bool mVisible;  };  //---------------------------------------------------------------------------- @@ -398,7 +401,10 @@ void LLTabContainer::draw()  				{  					break;  				} -				target_pixel_scroll += (*iter)->mButton->getRect().getWidth(); + +				if( (*iter)->mVisible ) +					target_pixel_scroll += (*iter)->mButton->getRect().getWidth(); +  				cur_scroll_pos--;  			} @@ -467,6 +473,12 @@ void LLTabContainer::draw()  		{  			LLTabTuple* tuple = *iter; +			if( !tuple->mVisible ) +			{ +				tuple->mButton->setVisible( false ); +				continue; +			} +  			tuple->mButton->translate( left ? left - tuple->mButton->getRect().mLeft : 0,  									   top ? top - tuple->mButton->getRect().mTop : 0 );  			if (top) top -= BTN_HEIGHT + tabcntrv_pad; @@ -1505,7 +1517,7 @@ BOOL LLTabContainer::setTab(S32 which)  	}  	BOOL is_visible = FALSE; -	if (selected_tuple->mButton->getEnabled()) +	if( selected_tuple->mButton->getEnabled() && selected_tuple->mVisible )  	{  		setCurrentPanelIndex(which); @@ -2121,3 +2133,35 @@ S32 LLTabContainer::getTotalTabWidth() const  {      return mTotalTabWidth;  } + +void LLTabContainer::setTabVisibility( LLPanel const *aPanel, bool aVisible ) +{ +	for( tuple_list_t::const_iterator itr = mTabList.begin(); itr != mTabList.end(); ++itr ) +	{ +		LLTabTuple const *pTT = *itr; +		if( pTT->mTabPanel == aPanel ) +		{ +			pTT->mVisible = aVisible; +			break; +		} +	} + +	bool foundTab( false ); +	for( tuple_list_t::const_iterator itr = mTabList.begin(); itr != mTabList.end(); ++itr ) +	{ +		LLTabTuple const *pTT = *itr; +		if( pTT->mVisible ) +		{ +			this->selectTab( itr - mTabList.begin() ); +			foundTab = true; +			break; +		} +	} + +	if( foundTab ) +		this->setVisible( TRUE ); +	else +		this->setVisible( FALSE ); + +	updateMaxScrollPos(); +} diff --git a/indra/llui/lltabcontainer.h b/indra/llui/lltabcontainer.h index 4a5f08f5d3..6bf963313c 100644 --- a/indra/llui/lltabcontainer.h +++ b/indra/llui/lltabcontainer.h @@ -216,6 +216,8 @@ public:  	S32			getMinTabWidth() const { return mMinTabWidth; }  	S32			getMaxTabWidth() const { return mMaxTabWidth; } +	void setTabVisibility( LLPanel const *aPanel, bool ); +  	void		startDragAndDropDelayTimer() { mDragAndDropDelayTimer.start(); }  	void onTabBtn( const LLSD& data, LLPanel* panel ); diff --git a/indra/llui/lltextbase.cpp b/indra/llui/lltextbase.cpp index c570285856..a23741b6dd 100644 --- a/indra/llui/lltextbase.cpp +++ b/indra/llui/lltextbase.cpp @@ -1222,6 +1222,17 @@ void LLTextBase::draw()  		gl_rect_2d(text_rect, bg_color % alpha, TRUE);  	} +	// Draw highlighted if needed +	if( ll::ui::SearchableControl::getHighlighted() ) +	{ +		LLColor4 bg_color = ll::ui::SearchableControl::getHighlightColor(); +		LLRect bg_rect = mVisibleTextRect; +		if( mScroller ) +			bg_rect.intersectWith( text_rect ); + +		gl_rect_2d( text_rect, bg_color, TRUE ); +	} +	  	bool should_clip = mClip || mScroller != NULL;  	{ LLLocalClipRect clip(text_rect, should_clip); diff --git a/indra/llui/lltextbase.h b/indra/llui/lltextbase.h index 5fdde445ef..9831c35858 100644 --- a/indra/llui/lltextbase.h +++ b/indra/llui/lltextbase.h @@ -275,7 +275,8 @@ typedef LLPointer<LLTextSegment> LLTextSegmentPtr;  class LLTextBase   :	public LLUICtrl,  	protected LLEditMenuHandler, -	public LLSpellCheckMenuHandler +	public LLSpellCheckMenuHandler, +	public ll::ui::SearchableControl  {  public:  	friend class LLTextSegment; @@ -617,6 +618,11 @@ protected:  	void							appendAndHighlightTextImpl(const std::string &new_text, S32 highlight_part, const LLStyle::Params& style_params, bool underline_on_hover_only = false);  	S32 normalizeUri(std::string& uri); +protected: +	virtual std::string _getSearchText() const +	{ +		return mLabel.getString() + getToolTip(); +	}  protected:  	// text segmentation and flow diff --git a/indra/llui/lluictrl.h b/indra/llui/lluictrl.h index 550bee5c70..63baed6793 100644 --- a/indra/llui/lluictrl.h +++ b/indra/llui/lluictrl.h @@ -37,6 +37,7 @@  #include "llinitparam.h"  #include "llview.h"  #include "llviewmodel.h"		// *TODO move dependency to .cpp file +#include "llsearchablecontrol.h"  const BOOL TAKE_FOCUS_YES = TRUE;  const BOOL TAKE_FOCUS_NO  = FALSE; | 
