diff options
Diffstat (limited to 'indra/llui')
| -rw-r--r-- | indra/llui/llcheckboxctrl.cpp | 30 | ||||
| -rw-r--r-- | indra/llui/llfolderviewmodel.h | 6 | ||||
| -rw-r--r-- | indra/llui/lllayoutstack.cpp | 2 | ||||
| -rw-r--r-- | indra/llui/llmenugl.cpp | 21 | ||||
| -rw-r--r-- | indra/llui/llmenugl.h | 2 | ||||
| -rw-r--r-- | indra/llui/lltextbase.cpp | 2 | ||||
| -rw-r--r-- | indra/llui/lltextbox.cpp | 4 | ||||
| -rw-r--r-- | indra/llui/lltextbox.h | 2 | ||||
| -rw-r--r-- | indra/llui/llurlentry.cpp | 50 | ||||
| -rw-r--r-- | indra/llui/llurlentry.h | 24 | ||||
| -rw-r--r-- | indra/llui/llview.cpp | 4 | 
11 files changed, 108 insertions, 39 deletions
| diff --git a/indra/llui/llcheckboxctrl.cpp b/indra/llui/llcheckboxctrl.cpp index 6a51c4240b..08da599ef2 100644 --- a/indra/llui/llcheckboxctrl.cpp +++ b/indra/llui/llcheckboxctrl.cpp @@ -187,10 +187,32 @@ void LLCheckBoxCtrl::clear()  void LLCheckBoxCtrl::reshape(S32 width, S32 height, BOOL called_from_parent)  { -	S32 label_top = mLabel->getRect().mTop; -	mLabel->reshapeToFitText(); +    LLRect rect = getRect(); +    S32 delta_width = width - rect.getWidth(); +    S32 delta_height = height - rect.getHeight(); -	LLRect label_rect = mLabel->getRect(); +    if (delta_width || delta_height) +    { +        // adjust our rectangle +        rect.mRight = getRect().mLeft + width; +        rect.mTop = getRect().mBottom + height; +        setRect(rect); +    } + +    // reshapeToFitText reshapes label to minimal size according to last bounding box +    // it will work fine in case of decrease of space, but if we get more space or text +    // becomes longer, label will fail to grow so reinit label's dimentions. +     +    static LLUICachedControl<S32> llcheckboxctrl_hpad("UICheckboxctrlHPad", 0); +    LLRect label_rect = mLabel->getRect(); +    S32 new_width = getRect().getWidth() - label_rect.mLeft - llcheckboxctrl_hpad; +    label_rect.mRight = label_rect.mLeft + new_width; +    mLabel->setRect(label_rect); + +	S32 label_top = label_rect.mTop; +	mLabel->reshapeToFitText(TRUE); + +    label_rect = mLabel->getRect();  	if (label_top != label_rect.mTop && mWordWrap == WRAP_DOWN)  	{  		// reshapeToFitText uses LLView::reshape() which always reshapes @@ -210,6 +232,8 @@ void LLCheckBoxCtrl::reshape(S32 width, S32 height, BOOL called_from_parent)  		llmax(btn_rect.getWidth(), label_rect.mRight - btn_rect.mLeft),  		llmax(label_rect.mTop - btn_rect.mBottom, btn_rect.getHeight()));  	mButton->setShape(btn_rect); + +    updateBoundingRect();  }  //virtual diff --git a/indra/llui/llfolderviewmodel.h b/indra/llui/llfolderviewmodel.h index f4ddfa8f18..e62b2779dd 100644 --- a/indra/llui/llfolderviewmodel.h +++ b/indra/llui/llfolderviewmodel.h @@ -204,6 +204,7 @@ public:  	virtual bool hasChildren() const = 0;  	virtual void addChild(LLFolderViewModelItem* child) = 0;  	virtual void removeChild(LLFolderViewModelItem* child) = 0; +	virtual void clearChildren() = 0;  	// This method will be called to determine if a drop can be  	// performed, and will set drop to TRUE if a drop is @@ -301,9 +302,8 @@ public:  	virtual void clearChildren()  	{ -		// As this is cleaning the whole list of children wholesale, we do need to delete the pointed objects -		// This is different and not equivalent to calling removeChild() on each child -		std::for_each(mChildren.begin(), mChildren.end(), DeletePointer()); +		// We are working with models that belong to views as LLPointers, clean the list, let poiters handle the rest +		std::for_each(mChildren.begin(), mChildren.end(), [](LLFolderViewModelItem* c) {c->setParent(NULL); });  		mChildren.clear();  		dirtyDescendantsFilter();  		dirtyFilter(); diff --git a/indra/llui/lllayoutstack.cpp b/indra/llui/lllayoutstack.cpp index 4aae1e374b..29a156e933 100644 --- a/indra/llui/lllayoutstack.cpp +++ b/indra/llui/lllayoutstack.cpp @@ -166,7 +166,7 @@ void LLLayoutPanel::setVisible( BOOL visible )  void LLLayoutPanel::reshape( S32 width, S32 height, BOOL called_from_parent /*= TRUE*/ )  { -	if (width == getRect().getWidth() && height == getRect().getHeight()) return; +	if (width == getRect().getWidth() && height == getRect().getHeight() && !LLView::sForceReshape) return;  	if (!mIgnoreReshape && mAutoResize == false)  	{ diff --git a/indra/llui/llmenugl.cpp b/indra/llui/llmenugl.cpp index 5568a84494..2c28b7943e 100644 --- a/indra/llui/llmenugl.cpp +++ b/indra/llui/llmenugl.cpp @@ -3244,7 +3244,7 @@ void hide_top_view( LLView* view )  // x and y are the desired location for the popup, in the spawning_view's  // coordinate frame, NOT necessarily the mouse location  // static -void LLMenuGL::showPopup(LLView* spawning_view, LLMenuGL* menu, S32 x, S32 y) +void LLMenuGL::showPopup(LLView* spawning_view, LLMenuGL* menu, S32 x, S32 y, S32 mouse_x, S32 mouse_y)  {  	const S32 CURSOR_HEIGHT = 22;		// Approximate "normal" cursor size  	const S32 CURSOR_WIDTH = 12; @@ -3275,12 +3275,6 @@ void LLMenuGL::showPopup(LLView* spawning_view, LLMenuGL* menu, S32 x, S32 y)  		}  	} -	// Save click point for detecting cursor moves before mouse-up. -	// Must be in local coords to compare with mouseUp events. -	// If the mouse doesn't move, the menu will stay open ala the Mac. -	// See also LLContextMenu::show() -	S32 mouse_x, mouse_y; -  	// Resetting scrolling position  	if (menu->isScrollable() && menu->isScrollPositionOnShowReset())  	{ @@ -3291,7 +3285,18 @@ void LLMenuGL::showPopup(LLView* spawning_view, LLMenuGL* menu, S32 x, S32 y)  	menu->needsArrange();  	menu->arrangeAndClear(); -	LLUI::getInstance()->getMousePositionLocal(menu->getParent(), &mouse_x, &mouse_y); +	if ((mouse_x == 0) || (mouse_y == 0)) + +	{ +		// Save click point for detecting cursor moves before mouse-up. +		// Must be in local coords to compare with mouseUp events. +		// If the mouse doesn't move, the menu will stay open ala the Mac. +		// See also LLContextMenu::show() + +		LLUI::getInstance()->getMousePositionLocal(menu->getParent(), &mouse_x, &mouse_y); +	} +	 +	  	LLMenuHolderGL::sContextMenuSpawnPos.set(mouse_x,mouse_y);  	const LLRect menu_region_rect = LLMenuGL::sMenuContainer->getRect(); diff --git a/indra/llui/llmenugl.h b/indra/llui/llmenugl.h index 1f11f26192..805620bf9b 100644 --- a/indra/llui/llmenugl.h +++ b/indra/llui/llmenugl.h @@ -510,7 +510,7 @@ public:  	void createJumpKeys();  	// Show popup at a specific location, in the spawn_view's coordinate frame -	static void showPopup(LLView* spawning_view, LLMenuGL* menu, S32 x, S32 y); +	static void showPopup(LLView* spawning_view, LLMenuGL* menu, S32 x, S32 y, S32 mouse_x = 0, S32 mouse_y = 0);  	// Whether to drop shadow menu bar   	void setDropShadowed( const BOOL shadowed ); diff --git a/indra/llui/lltextbase.cpp b/indra/llui/lltextbase.cpp index ff72417867..20bea7fe24 100644 --- a/indra/llui/lltextbase.cpp +++ b/indra/llui/lltextbase.cpp @@ -1179,7 +1179,7 @@ BOOL LLTextBase::handleToolTip(S32 x, S32 y, MASK mask)  void LLTextBase::reshape(S32 width, S32 height, BOOL called_from_parent)  { -	if (width != getRect().getWidth() || height != getRect().getHeight()) +	if (width != getRect().getWidth() || height != getRect().getHeight() || LLView::sForceReshape)  	{  		bool scrolled_to_bottom = mScroller ? mScroller->isAtBottom() : false; diff --git a/indra/llui/lltextbox.cpp b/indra/llui/lltextbox.cpp index 0afd32f332..134afc005b 100644 --- a/indra/llui/lltextbox.cpp +++ b/indra/llui/lltextbox.cpp @@ -163,13 +163,13 @@ BOOL LLTextBox::setTextArg( const std::string& key, const LLStringExplicit& text  } -void LLTextBox::reshapeToFitText() +void LLTextBox::reshapeToFitText(BOOL called_from_parent)  {  	reflow();  	S32 width = getTextPixelWidth();  	S32 height = getTextPixelHeight(); -	reshape( width + 2 * mHPad, height + 2 * mVPad, FALSE ); +	reshape( width + 2 * mHPad, height + 2 * mVPad, called_from_parent );  } diff --git a/indra/llui/lltextbox.h b/indra/llui/lltextbox.h index 061d2dd23d..c3e3b61912 100644 --- a/indra/llui/lltextbox.h +++ b/indra/llui/lltextbox.h @@ -60,7 +60,7 @@ public:  	void			setHAlign( LLFontGL::HAlign align )		{ mHAlign = align; }  	void			setClickedCallback( boost::function<void (void*)> cb, void* userdata = NULL ); -	void			reshapeToFitText(); +	void			reshapeToFitText(BOOL called_from_parent = FALSE);  	S32				getTextPixelWidth();  	S32				getTextPixelHeight(); diff --git a/indra/llui/llurlentry.cpp b/indra/llui/llurlentry.cpp index a69c0eb008..20dda54771 100644 --- a/indra/llui/llurlentry.cpp +++ b/indra/llui/llurlentry.cpp @@ -517,8 +517,7 @@ LLUrlEntrySimpleSecondlifeURL::LLUrlEntrySimpleSecondlifeURL()  // secondlife:///app/agent/0e346d8b-4433-4d66-a6b0-fd37083abc4c/about  // x-grid-location-info://lincoln.lindenlab.com/app/agent/0e346d8b-4433-4d66-a6b0-fd37083abc4c/about  // -LLUrlEntryAgent::LLUrlEntryAgent() : -	mAvatarNameCacheConnection() +LLUrlEntryAgent::LLUrlEntryAgent()  {  	mPattern = boost::regex(APP_HEADER_REGEX "/agent/[\\da-f-]+/\\w+",  							boost::regex::perl|boost::regex::icase); @@ -549,7 +548,15 @@ void LLUrlEntryAgent::callObservers(const std::string &id,  void LLUrlEntryAgent::onAvatarNameCache(const LLUUID& id,  										const LLAvatarName& av_name)  { -	mAvatarNameCacheConnection.disconnect(); +	avatar_name_cache_connection_map_t::iterator it = mAvatarNameCacheConnections.find(id); +	if (it != mAvatarNameCacheConnections.end()) +	{ +		if (it->second.connected()) +		{ +			it->second.disconnect(); +		} +		mAvatarNameCacheConnections.erase(it); +	}   	std::string label = av_name.getCompleteName(); @@ -636,11 +643,17 @@ std::string LLUrlEntryAgent::getLabel(const std::string &url, const LLUrlLabelCa  	}  	else  	{ -		if (mAvatarNameCacheConnection.connected()) +		avatar_name_cache_connection_map_t::iterator it = mAvatarNameCacheConnections.find(agent_id); +		if (it != mAvatarNameCacheConnections.end())  		{ -			mAvatarNameCacheConnection.disconnect(); +			if (it->second.connected()) +			{ +				it->second.disconnect(); +			} +			mAvatarNameCacheConnections.erase(it);  		} -		mAvatarNameCacheConnection = LLAvatarNameCache::get(agent_id, boost::bind(&LLUrlEntryAgent::onAvatarNameCache, this, _1, _2)); +		mAvatarNameCacheConnections[agent_id] = LLAvatarNameCache::get(agent_id, boost::bind(&LLUrlEntryAgent::onAvatarNameCache, this, _1, _2)); +  		addObserver(agent_id_string, url, cb);  		return LLTrans::getString("LoadingData");  	} @@ -701,14 +714,21 @@ std::string LLUrlEntryAgent::getIcon(const std::string &url)  // secondlife:///app/agent/0e346d8b-4433-4d66-a6b0-fd37083abc4c/(completename|displayname|username)  // x-grid-location-info://lincoln.lindenlab.com/app/agent/0e346d8b-4433-4d66-a6b0-fd37083abc4c/(completename|displayname|username)  // -LLUrlEntryAgentName::LLUrlEntryAgentName() : -	mAvatarNameCacheConnection() +LLUrlEntryAgentName::LLUrlEntryAgentName()  {}  void LLUrlEntryAgentName::onAvatarNameCache(const LLUUID& id,  										const LLAvatarName& av_name)  { -	mAvatarNameCacheConnection.disconnect(); +	avatar_name_cache_connection_map_t::iterator it = mAvatarNameCacheConnections.find(id); +	if (it != mAvatarNameCacheConnections.end()) +	{ +		if (it->second.connected()) +		{ +			it->second.disconnect(); +		} +		mAvatarNameCacheConnections.erase(it); +	}  	std::string label = getName(av_name);  	// received the agent name from the server - tell our observers @@ -743,11 +763,17 @@ std::string LLUrlEntryAgentName::getLabel(const std::string &url, const LLUrlLab  	}  	else  	{ -		if (mAvatarNameCacheConnection.connected()) +		avatar_name_cache_connection_map_t::iterator it = mAvatarNameCacheConnections.find(agent_id); +		if (it != mAvatarNameCacheConnections.end())  		{ -			mAvatarNameCacheConnection.disconnect(); +			if (it->second.connected()) +			{ +				it->second.disconnect(); +			} +			mAvatarNameCacheConnections.erase(it);  		} -		mAvatarNameCacheConnection = LLAvatarNameCache::get(agent_id, boost::bind(&LLUrlEntryAgentName::onAvatarNameCache, this, _1, _2)); +		mAvatarNameCacheConnections[agent_id] = LLAvatarNameCache::get(agent_id, boost::bind(&LLUrlEntryAgentName::onAvatarNameCache, this, _1, _2)); +  		addObserver(agent_id_string, url, cb);  		return LLTrans::getString("LoadingData");  	} diff --git a/indra/llui/llurlentry.h b/indra/llui/llurlentry.h index 0a0c247a6a..4af1ab5096 100644 --- a/indra/llui/llurlentry.h +++ b/indra/llui/llurlentry.h @@ -212,10 +212,14 @@ public:  	LLUrlEntryAgent();  	~LLUrlEntryAgent()  	{ -		if (mAvatarNameCacheConnection.connected()) +		for (avatar_name_cache_connection_map_t::iterator it = mAvatarNameCacheConnections.begin(); it != mAvatarNameCacheConnections.end(); ++it)  		{ -			mAvatarNameCacheConnection.disconnect(); +			if (it->second.connected()) +			{ +				it->second.disconnect(); +			}  		} +		mAvatarNameCacheConnections.clear();  	}  	/*virtual*/ std::string getLabel(const std::string &url, const LLUrlLabelCallback &cb);  	/*virtual*/ std::string getIcon(const std::string &url); @@ -227,7 +231,9 @@ protected:  	/*virtual*/ void callObservers(const std::string &id, const std::string &label, const std::string& icon);  private:  	void onAvatarNameCache(const LLUUID& id, const LLAvatarName& av_name); -	boost::signals2::connection mAvatarNameCacheConnection; + +	typedef std::map<LLUUID, boost::signals2::connection> avatar_name_cache_connection_map_t; +	avatar_name_cache_connection_map_t mAvatarNameCacheConnections;  };  /// @@ -241,10 +247,14 @@ public:  	LLUrlEntryAgentName();  	~LLUrlEntryAgentName()  	{ -		if (mAvatarNameCacheConnection.connected()) +		for (avatar_name_cache_connection_map_t::iterator it = mAvatarNameCacheConnections.begin(); it != mAvatarNameCacheConnections.end(); ++it)  		{ -			mAvatarNameCacheConnection.disconnect(); +			if (it->second.connected()) +			{ +				it->second.disconnect(); +			}  		} +		mAvatarNameCacheConnections.clear();  	}  	/*virtual*/ std::string getLabel(const std::string &url, const LLUrlLabelCallback &cb);  	/*virtual*/ LLStyle::Params getStyle() const; @@ -253,7 +263,9 @@ protected:  	virtual std::string getName(const LLAvatarName& avatar_name) = 0;  private:  	void onAvatarNameCache(const LLUUID& id, const LLAvatarName& av_name); -	boost::signals2::connection mAvatarNameCacheConnection; + +	typedef std::map<LLUUID, boost::signals2::connection> avatar_name_cache_connection_map_t; +	avatar_name_cache_connection_map_t mAvatarNameCacheConnections;  }; diff --git a/indra/llui/llview.cpp b/indra/llui/llview.cpp index e3a6a98a9f..cd47e2ecea 100644 --- a/indra/llui/llview.cpp +++ b/indra/llui/llview.cpp @@ -1402,7 +1402,9 @@ void LLView::reshape(S32 width, S32 height, BOOL called_from_parent)  			S32 delta_x = child_rect.mLeft - viewp->getRect().mLeft;  			S32 delta_y = child_rect.mBottom - viewp->getRect().mBottom;  			viewp->translate( delta_x, delta_y ); -			if (child_rect.getWidth() != viewp->getRect().getWidth() || child_rect.getHeight() != viewp->getRect().getHeight()) +			if (child_rect.getWidth() != viewp->getRect().getWidth() +                || child_rect.getHeight() != viewp->getRect().getHeight() +                || sForceReshape)  			{  				viewp->reshape(child_rect.getWidth(), child_rect.getHeight());  			} | 
