diff options
Diffstat (limited to 'indra/llui')
| -rw-r--r-- | indra/llui/lllineeditor.cpp | 17 | ||||
| -rw-r--r-- | indra/llui/lllineeditor.h | 2 | ||||
| -rw-r--r-- | indra/llui/llmenugl.cpp | 41 | ||||
| -rw-r--r-- | indra/llui/llmenugl.h | 4 | 
4 files changed, 58 insertions, 6 deletions
| diff --git a/indra/llui/lllineeditor.cpp b/indra/llui/lllineeditor.cpp index 1badd54fca..33037b5001 100644 --- a/indra/llui/lllineeditor.cpp +++ b/indra/llui/lllineeditor.cpp @@ -175,6 +175,14 @@ LLLineEditor::LLLineEditor(const LLLineEditor::Params& p)  	mTripleClickTimer.reset();  	setText(p.default_text()); +    if (p.initial_value.isProvided() +        && !p.control_name.isProvided()) +    { +        // Initial value often is descriptive, like "Type some ID here" +        // and can be longer than size limitation, ignore size +        setText(p.initial_value.getValue().asString(), false); +    } +  	// Initialize current history line iterator  	mCurrentHistoryLine = mLineHistory.begin(); @@ -390,6 +398,11 @@ void LLLineEditor::updateTextPadding()  void LLLineEditor::setText(const LLStringExplicit &new_text)  { +    setText(new_text, true); +} + +void LLLineEditor::setText(const LLStringExplicit &new_text, bool use_size_limit) +{  	// If new text is identical, don't copy and don't move insertion point  	if (mText.getString() == new_text)  	{ @@ -407,13 +420,13 @@ void LLLineEditor::setText(const LLStringExplicit &new_text)  	all_selected = all_selected || (len == 0 && hasFocus() && mSelectAllonFocusReceived);  	std::string truncated_utf8 = new_text; -	if (truncated_utf8.size() > (U32)mMaxLengthBytes) +	if (use_size_limit && truncated_utf8.size() > (U32)mMaxLengthBytes)  	{	  		truncated_utf8 = utf8str_truncate(new_text, mMaxLengthBytes);  	}  	mText.assign(truncated_utf8); -	if (mMaxLengthChars) +	if (use_size_limit && mMaxLengthChars)  	{  		mText.assign(utf8str_symbol_truncate(truncated_utf8, mMaxLengthChars));  	} diff --git a/indra/llui/lllineeditor.h b/indra/llui/lllineeditor.h index f84625bea7..ae4e05c065 100644 --- a/indra/llui/lllineeditor.h +++ b/indra/llui/lllineeditor.h @@ -320,6 +320,8 @@ private:  	virtual S32		getPreeditFontSize() const;  	virtual LLWString getPreeditString() const { return getWText(); } +    void			setText(const LLStringExplicit &new_text, bool use_size_limit); +  	void			setContextMenu(LLContextMenu* new_context_menu);  protected: diff --git a/indra/llui/llmenugl.cpp b/indra/llui/llmenugl.cpp index cdaf03ebde..80d12a0953 100644 --- a/indra/llui/llmenugl.cpp +++ b/indra/llui/llmenugl.cpp @@ -2362,6 +2362,16 @@ void LLMenuGL::arrange( void )  				(*item_iter)->setRect( rect );  			}  		} + + +        if (getTornOff()) +        { +            LLTearOffMenu * torn_off_menu = dynamic_cast<LLTearOffMenu*>(getParent()); +            if (torn_off_menu) +            { +                torn_off_menu->updateSize(); +            } +        }  	}  	if (mKeepFixedSize)  	{ @@ -3894,7 +3904,7 @@ LLTearOffMenu::LLTearOffMenu(LLMenuGL* menup) :  	LLRect rect;  	menup->localRectToOtherView(LLRect(-1, menup->getRect().getHeight(), menup->getRect().getWidth() + 3, 0), &rect, gFloaterView);  	// make sure this floater is big enough for menu -	mTargetHeight = (F32)(rect.getHeight() + floater_header_size); +	mTargetHeight = rect.getHeight() + floater_header_size;  	reshape(rect.getWidth(), rect.getHeight());  	setRect(rect); @@ -3926,12 +3936,12 @@ LLTearOffMenu::~LLTearOffMenu()  void LLTearOffMenu::draw()  {  	mMenu->setBackgroundVisible(isBackgroundOpaque()); -	mMenu->needsArrange();  	if (getRect().getHeight() != mTargetHeight)  	{  		// animate towards target height -		reshape(getRect().getWidth(), llceil(lerp((F32)getRect().getHeight(), mTargetHeight, LLSmoothInterpolation::getInterpolant(0.05f)))); +        reshape(getRect().getWidth(), llceil(lerp((F32)getRect().getHeight(), (F32)mTargetHeight, LLSmoothInterpolation::getInterpolant(0.05f)))); +        mMenu->needsArrange();  	}  	LLFloater::draw();  } @@ -4014,6 +4024,31 @@ LLTearOffMenu* LLTearOffMenu::create(LLMenuGL* menup)  	return tearoffp;  } +void LLTearOffMenu::updateSize() +{ +    if (mMenu) +    { +        S32 floater_header_size = getHeaderHeight(); +        const LLRect &floater_rect = getRect(); +        LLRect new_rect; +        mMenu->localRectToOtherView(LLRect(-1, mMenu->getRect().getHeight() + floater_header_size, mMenu->getRect().getWidth() + 3, 0), &new_rect, gFloaterView); + +        if (floater_rect.getWidth() != new_rect.getWidth() +            || mTargetHeight != new_rect.getHeight()) +        { +            // make sure this floater is big enough for menu +            mTargetHeight = new_rect.getHeight(); +            reshape(new_rect.getWidth(), mTargetHeight); + +            // Restore menu position +            LLRect menu_rect = mMenu->getRect(); +            menu_rect.setOriginAndSize(1, 1, +                menu_rect.getWidth(), menu_rect.getHeight()); +            mMenu->setRect(menu_rect); +        } +    } +} +  void LLTearOffMenu::closeTearOff()  {  	removeChild(mMenu); diff --git a/indra/llui/llmenugl.h b/indra/llui/llmenugl.h index 273bd789c4..01e677315b 100644 --- a/indra/llui/llmenugl.h +++ b/indra/llui/llmenugl.h @@ -873,6 +873,8 @@ public:  	virtual BOOL handleKeyHere(KEY key, MASK mask);  	virtual void translate(S32 x, S32 y); +	void updateSize(); +  private:  	LLTearOffMenu(LLMenuGL* menup); @@ -880,7 +882,7 @@ private:  	LLView*		mOldParent;  	LLMenuGL*	mMenu; -	F32			mTargetHeight; +	S32			mTargetHeight;  };  //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | 
