diff options
| author | Graham Linden graham@lindenlab.com <Graham Linden graham@lindenlab.com> | 2018-05-23 01:16:12 +0100 | 
|---|---|---|
| committer | Graham Linden graham@lindenlab.com <Graham Linden graham@lindenlab.com> | 2018-05-23 01:16:12 +0100 | 
| commit | 439273c9c11ec5f3c186fd7d97a28d11419153cd (patch) | |
| tree | f6e4f1566425921d71e40b9628011eb0f5f539f3 /indra/llui | |
| parent | 13536bb273b7413aa4461c8eeaf5a6a865f4234d (diff) | |
| parent | 689beff6698fcb8582c44f58bb9896606850b149 (diff) | |
Merge
Diffstat (limited to 'indra/llui')
| -rw-r--r-- | indra/llui/llbadge.cpp | 10 | ||||
| -rw-r--r-- | indra/llui/llbadge.h | 3 | ||||
| -rw-r--r-- | indra/llui/llbadgeowner.cpp | 8 | ||||
| -rw-r--r-- | indra/llui/llbadgeowner.h | 1 | ||||
| -rw-r--r-- | indra/llui/lllineeditor.cpp | 4 | ||||
| -rw-r--r-- | indra/llui/llmultislider.cpp | 49 | ||||
| -rw-r--r-- | indra/llui/llmultislider.h | 1 | ||||
| -rw-r--r-- | indra/llui/llmultisliderctrl.cpp | 5 | ||||
| -rw-r--r-- | indra/llui/llmultisliderctrl.h | 1 | ||||
| -rw-r--r-- | indra/llui/llscrolllistctrl.cpp | 4 | ||||
| -rw-r--r-- | indra/llui/lltrans.cpp | 60 | ||||
| -rw-r--r-- | indra/llui/lltrans.h | 9 | 
12 files changed, 129 insertions, 26 deletions
| diff --git a/indra/llui/llbadge.cpp b/indra/llui/llbadge.cpp index 15b6899d74..589b75ab5b 100644 --- a/indra/llui/llbadge.cpp +++ b/indra/llui/llbadge.cpp @@ -102,6 +102,7 @@ LLBadge::LLBadge(const LLBadge::Params& p)  	, mPaddingHoriz(p.padding_horiz)  	, mPaddingVert(p.padding_vert)  	, mParentScroller(NULL) +	, mDrawAtParentTop(false)  {  	if (mImage.isNull())  	{ @@ -307,7 +308,14 @@ void LLBadge::draw()  			// Compute y position  			if (mLocationOffsetVCenter == BADGE_OFFSET_NOT_SPECIFIED)  			{ -				badge_center_y = owner_rect.mBottom + owner_rect.getHeight() * mLocationPercentVCenter; +				if(mDrawAtParentTop) +				{ +					badge_center_y = owner_rect.mTop - badge_height * 0.5f - 1; +				} +				else +				{ +					badge_center_y = owner_rect.mBottom + owner_rect.getHeight() * mLocationPercentVCenter; +				}  			}  			else  			{ diff --git a/indra/llui/llbadge.h b/indra/llui/llbadge.h index 4b21a71aaa..55f92e6e34 100644 --- a/indra/llui/llbadge.h +++ b/indra/llui/llbadge.h @@ -137,6 +137,8 @@ public:  	const std::string	getLabel() const { return wstring_to_utf8str(mLabel); }  	void				setLabel( const LLStringExplicit& label); +	void				setDrawAtParentTop(bool draw_at_top) { mDrawAtParentTop = draw_at_top;} +  private:  	LLPointer< LLUIImage >	mBorderImage;  	LLUIColor				mBorderColor; @@ -164,6 +166,7 @@ private:  	F32						mPaddingVert;  	LLScrollContainer*		mParentScroller; +	bool					mDrawAtParentTop;  };  // Build time optimization, generate once in .cpp file diff --git a/indra/llui/llbadgeowner.cpp b/indra/llui/llbadgeowner.cpp index 55e64bb940..0557cd4375 100644 --- a/indra/llui/llbadgeowner.cpp +++ b/indra/llui/llbadgeowner.cpp @@ -64,6 +64,14 @@ void LLBadgeOwner::setBadgeVisibility(bool visible)  	}  } +void LLBadgeOwner::setDrawBadgeAtTop(bool draw_at_top) +{ +	if (mBadge) +	{ +		mBadge->setDrawAtParentTop(draw_at_top); +	} +} +  void LLBadgeOwner::addBadgeToParentHolder()  {  	LLView * owner_view = mBadgeOwnerView.get(); diff --git a/indra/llui/llbadgeowner.h b/indra/llui/llbadgeowner.h index 53c2de95c8..01ed95f3a3 100644 --- a/indra/llui/llbadgeowner.h +++ b/indra/llui/llbadgeowner.h @@ -45,6 +45,7 @@ public:  	bool hasBadgeHolderParent() const { return mHasBadgeHolderParent; };  	void setBadgeVisibility(bool visible); +	void setDrawBadgeAtTop(bool draw_at_top);  private: diff --git a/indra/llui/lllineeditor.cpp b/indra/llui/lllineeditor.cpp index becb45fa79..bd6b00d38b 100644 --- a/indra/llui/lllineeditor.cpp +++ b/indra/llui/lllineeditor.cpp @@ -1630,12 +1630,12 @@ BOOL LLLineEditor::handleUnicodeCharHere(llwchar uni_char)  BOOL LLLineEditor::canDoDelete() const  { -	return ( !mReadOnly && mText.length() > 0 && (!mPassDelete || (hasSelection() || (getCursor() < mText.length()))) ); +	return ( !mReadOnly && (!mPassDelete || (hasSelection() || (getCursor() < mText.length()))) );  }  void LLLineEditor::doDelete()  { -	if (canDoDelete()) +	if (canDoDelete() && mText.length() > 0)  	{  		// Prepare for possible rollback  		LLLineEditorRollback rollback( this ); diff --git a/indra/llui/llmultislider.cpp b/indra/llui/llmultislider.cpp index 0aa3e17075..93045a6578 100644 --- a/indra/llui/llmultislider.cpp +++ b/indra/llui/llmultislider.cpp @@ -196,7 +196,11 @@ void LLMultiSlider::setValue(const LLSD& value)  F32 LLMultiSlider::getSliderValue(const std::string& name) const  { -	return (F32)mValue[name].asReal(); +	if (mValue.has(name)) +	{ +		return (F32)mValue[name].asReal(); +	} +	return 0;  }  void LLMultiSlider::setCurSlider(const std::string& name) @@ -206,6 +210,11 @@ void LLMultiSlider::setCurSlider(const std::string& name)  	}  } +void LLMultiSlider::resetCurSlider() +{ +	mCurSlider = LLStringUtil::null; +} +  const std::string& LLMultiSlider::addSlider()  {  	return addSlider(mInitialValue); @@ -334,10 +343,15 @@ void LLMultiSlider::deleteSlider(const std::string& name)  void LLMultiSlider::clear()  { -	while(mThumbRects.size() > 0) { +	while(mThumbRects.size() > 0 && mValue.size() > 0) {  		deleteCurSlider();  	} +	if (mThumbRects.size() > 0 || mValue.size() > 0) +	{ +		LL_WARNS() << "Failed to fully clear Multi slider" << LL_ENDL; +	} +  	LLF32UICtrl::clear();  } @@ -416,20 +430,23 @@ BOOL LLMultiSlider::handleMouseDown(S32 x, S32 y, MASK mask)  			}  		} -		// Find the offset of the actual mouse location from the center of the thumb. -		if (mThumbRects[mCurSlider].pointInRect(x,y)) +		if (!mCurSlider.empty())  		{ -			mMouseOffset = (mThumbRects[mCurSlider].mLeft + mThumbWidth/2) - x; -		} -		else -		{ -			mMouseOffset = 0; -		} +			// Find the offset of the actual mouse location from the center of the thumb. +			if (mThumbRects[mCurSlider].pointInRect(x,y)) +			{ +				mMouseOffset = (mThumbRects[mCurSlider].mLeft + mThumbWidth/2) - x; +			} +			else +			{ +				mMouseOffset = 0; +			} -		// Start dragging the thumb -		// No handler needed for focus lost since this class has no state that depends on it. -		gFocusMgr.setMouseCapture( this ); -		mDragStartThumbRect = mThumbRects[mCurSlider];				 +			// Start dragging the thumb +			// No handler needed for focus lost since this class has no state that depends on it. +			gFocusMgr.setMouseCapture( this ); +			mDragStartThumbRect = mThumbRects[mCurSlider]; +		}  	}  	make_ui_sound("UISndClick"); @@ -546,7 +563,7 @@ void LLMultiSlider::draw()  		thumb_imagep->drawSolid(mDragStartThumbRect, mThumbCenterColor.get() % 0.3f);  		// draw the highlight -		if (hasFocus()) +		if (hasFocus() && !mCurSlider.empty())  		{  			thumb_imagep->drawBorder(mThumbRects[mCurSlider], gFocusMgr.getFocusColor(), gFocusMgr.getFocusFlashWidth());  		} @@ -578,7 +595,7 @@ void LLMultiSlider::draw()  	else  	{   		// draw highlight -		if (hasFocus()) +		if (hasFocus() && !mCurSlider.empty())  		{  			thumb_imagep->drawBorder(mThumbRects[mCurSlider], gFocusMgr.getFocusColor(), gFocusMgr.getFocusFlashWidth());  		} diff --git a/indra/llui/llmultislider.h b/indra/llui/llmultislider.h index 2b422e89c9..927063a5fd 100644 --- a/indra/llui/llmultislider.h +++ b/indra/llui/llmultislider.h @@ -76,6 +76,7 @@ public:  	const std::string&	getCurSlider() const					{ return mCurSlider; }  	F32					getCurSliderValue() const				{ return getSliderValue(mCurSlider); }  	void				setCurSlider(const std::string& name); +	void				resetCurSlider();  	void				setCurSliderValue(F32 val, BOOL from_event = false) { setSliderValue(mCurSlider, val, from_event); }  	/*virtual*/ void	setValue(const LLSD& value); diff --git a/indra/llui/llmultisliderctrl.cpp b/indra/llui/llmultisliderctrl.cpp index c460a08afc..a982d431b3 100644 --- a/indra/llui/llmultisliderctrl.cpp +++ b/indra/llui/llmultisliderctrl.cpp @@ -213,6 +213,11 @@ void LLMultiSliderCtrl::setCurSlider(const std::string& name)  	mCurValue = mMultiSlider->getCurSliderValue();  } +void LLMultiSliderCtrl::resetCurSlider() +{ +	mMultiSlider->resetCurSlider(); +} +  BOOL LLMultiSliderCtrl::setLabelArg( const std::string& key, const LLStringExplicit& text )  {  	BOOL res = FALSE; diff --git a/indra/llui/llmultisliderctrl.h b/indra/llui/llmultisliderctrl.h index b6a3542376..84378ff7b2 100644 --- a/indra/llui/llmultisliderctrl.h +++ b/indra/llui/llmultisliderctrl.h @@ -84,6 +84,7 @@ public:  	const std::string& getCurSlider() const					{ return mMultiSlider->getCurSlider(); }  	F32				getCurSliderValue() const				{ return mCurValue; }  	void			setCurSlider(const std::string& name);		 +	void			resetCurSlider();  	void			setCurSliderValue(F32 val, BOOL from_event = false) { setSliderValue(mMultiSlider->getCurSlider(), val, from_event); }  	virtual void	setMinValue(const LLSD& min_value)	{ setMinValue((F32)min_value.asReal()); } diff --git a/indra/llui/llscrolllistctrl.cpp b/indra/llui/llscrolllistctrl.cpp index 7c1f4a4dca..212e27477b 100644 --- a/indra/llui/llscrolllistctrl.cpp +++ b/indra/llui/llscrolllistctrl.cpp @@ -1964,6 +1964,10 @@ BOOL LLScrollListCtrl::handleClick(S32 x, S32 y, MASK mask)  					LLScrollListCell* cellp = item->getColumn(column_index);  					cellp->setValue(item_value);  					cellp->onCommit(); +					if (mLastSelected == NULL) +					{ +						break; +					}  				}  			}  			//FIXME: find a better way to signal cell changes diff --git a/indra/llui/lltrans.cpp b/indra/llui/lltrans.cpp index 4d4ff4236d..a1a8feedaa 100644 --- a/indra/llui/lltrans.cpp +++ b/indra/llui/lltrans.cpp @@ -36,6 +36,7 @@  #include <map>  LLTrans::template_map_t LLTrans::sStringTemplates; +LLTrans::template_map_t LLTrans::sDefaultStringTemplates;  LLStringUtil::format_map_t LLTrans::sDefaultArgs;  struct StringDef : public LLInitParam::Block<StringDef> @@ -76,7 +77,7 @@ bool LLTrans::parseStrings(LLXMLNodePtr &root, const std::set<std::string>& defa  		LL_ERRS() << "Problem reading strings: " << xml_filename << LL_ENDL;  		return false;  	} -	 +	static bool default_strings_init = false;  	sStringTemplates.clear();  	sDefaultArgs.clear(); @@ -86,7 +87,10 @@ bool LLTrans::parseStrings(LLXMLNodePtr &root, const std::set<std::string>& defa  	{  		LLTransTemplate xml_template(it->name, it->value);  		sStringTemplates[xml_template.mName] = xml_template; -		 +		if (!default_strings_init) +		{ +			sDefaultStringTemplates[xml_template.mName] = xml_template; +		}  		std::set<std::string>::const_iterator iter = default_args.find(xml_template.mName);  		if (iter != default_args.end())  		{ @@ -96,6 +100,7 @@ bool LLTrans::parseStrings(LLXMLNodePtr &root, const std::set<std::string>& defa  			sDefaultArgs[name] = xml_template.mText;  		}  	} +	default_strings_init = true;  	return true;  } @@ -138,12 +143,17 @@ bool LLTrans::parseLanguageStrings(LLXMLNodePtr &root)  static LLTrace::BlockTimerStatHandle FTM_GET_TRANS("Translate string");  //static  -std::string LLTrans::getString(const std::string &xml_desc, const LLStringUtil::format_map_t& msg_args) +std::string LLTrans::getString(const std::string &xml_desc, const LLStringUtil::format_map_t& msg_args, bool def_string)  {  	// Don't care about time as much as call count.  Make sure we're not  	// calling LLTrans::getString() in an inner loop. JC  	LL_RECORD_BLOCK_TIME(FTM_GET_TRANS); +	if (def_string) +	{ +		return getDefString(xml_desc, msg_args); +	} +  	template_map_t::iterator iter = sStringTemplates.find(xml_desc);  	if (iter != sStringTemplates.end())  	{ @@ -161,13 +171,38 @@ std::string LLTrans::getString(const std::string &xml_desc, const LLStringUtil::  	}  } +//static  +std::string LLTrans::getDefString(const std::string &xml_desc, const LLStringUtil::format_map_t& msg_args) +{ +	template_map_t::iterator iter = sDefaultStringTemplates.find(xml_desc); +	if (iter != sDefaultStringTemplates.end()) +	{ +		std::string text = iter->second.mText; +		LLStringUtil::format_map_t args = sDefaultArgs; +		args.insert(msg_args.begin(), msg_args.end()); +		LLStringUtil::format(text, args); + +		return text; +	} +	else +	{ +		LL_WARNS_ONCE("configuration") << "Missing String in strings.xml: [" << xml_desc << "]" << LL_ENDL; +		return "MissingString(" + xml_desc + ")"; +	} +} +  //static -std::string LLTrans::getString(const std::string &xml_desc, const LLSD& msg_args) +std::string LLTrans::getString(const std::string &xml_desc, const LLSD& msg_args, bool def_string)  {  	// Don't care about time as much as call count.  Make sure we're not  	// calling LLTrans::getString() in an inner loop. JC  	LL_RECORD_BLOCK_TIME(FTM_GET_TRANS); +	if (def_string) +	{ +		return getDefString(xml_desc, msg_args); +	} +  	template_map_t::iterator iter = sStringTemplates.find(xml_desc);  	if (iter != sStringTemplates.end())  	{ @@ -182,6 +217,23 @@ std::string LLTrans::getString(const std::string &xml_desc, const LLSD& msg_args  	}  } +//static +std::string LLTrans::getDefString(const std::string &xml_desc, const LLSD& msg_args) +{ +	template_map_t::iterator iter = sDefaultStringTemplates.find(xml_desc); +	if (iter != sDefaultStringTemplates.end()) +	{ +		std::string text = iter->second.mText; +		LLStringUtil::format(text, msg_args); +		return text; +	} +	else +	{ +		LL_WARNS_ONCE("configuration") << "Missing String in strings.xml: [" << xml_desc << "]" << LL_ENDL; +		return "MissingString(" + xml_desc + ")"; +	} +} +  //static   bool LLTrans::findString(std::string &result, const std::string &xml_desc, const LLStringUtil::format_map_t& msg_args)  { diff --git a/indra/llui/lltrans.h b/indra/llui/lltrans.h index a47ce94f08..9bd751fc78 100644 --- a/indra/llui/lltrans.h +++ b/indra/llui/lltrans.h @@ -76,8 +76,10 @@ public:  	 * @param args A list of substrings to replace in the string  	 * @returns Translated string  	 */ -	static std::string getString(const std::string &xml_desc, const LLStringUtil::format_map_t& args); -	static std::string getString(const std::string &xml_desc, const LLSD& args); +	static std::string getString(const std::string &xml_desc, const LLStringUtil::format_map_t& args, bool def_string = false); +	static std::string getDefString(const std::string &xml_desc, const LLStringUtil::format_map_t& args); +	static std::string getString(const std::string &xml_desc, const LLSD& args, bool def_string = false); +	static std::string getDefString(const std::string &xml_desc, const LLSD& args);  	static bool findString(std::string &result, const std::string &xml_desc, const LLStringUtil::format_map_t& args);  	static bool findString(std::string &result, const std::string &xml_desc, const LLSD& args); @@ -92,7 +94,7 @@ public:  	 * @param xml_desc String's description  	 * @returns Translated string  	 */ -	static std::string getString(const std::string &xml_desc) +	static std::string getString(const std::string &xml_desc, bool def_string = false)  	{  		LLStringUtil::format_map_t empty;  		return getString(xml_desc, empty); @@ -128,6 +130,7 @@ public:  private:  	typedef std::map<std::string, LLTransTemplate > template_map_t;  	static template_map_t sStringTemplates; +	static template_map_t sDefaultStringTemplates;  	static LLStringUtil::format_map_t sDefaultArgs;  }; | 
