diff options
| -rw-r--r-- | indra/llui/llurlentry.cpp | 2 | ||||
| -rw-r--r-- | indra/newview/llbottomtray.cpp | 159 | ||||
| -rw-r--r-- | indra/newview/llbottomtray.h | 8 | ||||
| -rw-r--r-- | indra/newview/llfolderview.cpp | 14 | ||||
| -rw-r--r-- | indra/newview/llimfloater.cpp | 6 | ||||
| -rw-r--r-- | indra/newview/skins/default/xui/en/notifications.xml | 3 | 
6 files changed, 153 insertions, 39 deletions
diff --git a/indra/llui/llurlentry.cpp b/indra/llui/llurlentry.cpp index 92b7816bdd..3c73ae9b0c 100644 --- a/indra/llui/llurlentry.cpp +++ b/indra/llui/llurlentry.cpp @@ -287,7 +287,7 @@ std::string LLUrlEntrySLURL::getLabel(const std::string &url, const LLUrlLabelCa  std::string LLUrlEntrySLURL::getLocation(const std::string &url) const  {  	// return the part of the Url after slurl.com/secondlife/ -	const std::string search_string = "secondlife"; +	const std::string search_string = "/secondlife";  	size_t pos = url.find(search_string);  	if (pos == std::string::npos)  	{ diff --git a/indra/newview/llbottomtray.cpp b/indra/newview/llbottomtray.cpp index 93b708f299..2958565fdf 100644 --- a/indra/newview/llbottomtray.cpp +++ b/indra/newview/llbottomtray.cpp @@ -60,6 +60,26 @@ namespace  	const std::string& PANEL_MOVEMENT_NAME	= "movement_panel";  	const std::string& PANEL_CAMERA_NAME	= "cam_panel";  	const std::string& PANEL_GESTURE_NAME	= "gesture_panel"; + +	S32 get_panel_min_width(LLLayoutStack* stack, LLPanel* panel) +	{ +		S32 minimal_width = 0; +		if ( panel && panel->getVisible() ) +		{ +			stack->getPanelMinSize(panel->getName(), &minimal_width, NULL); +		} +		return minimal_width; +	} + +	S32 get_curr_width(LLUICtrl* ctrl) +	{ +		S32 cur_width = 0; +		if ( ctrl && ctrl->getVisible() ) +		{ +			cur_width = ctrl->getRect().getWidth(); +		} +		return cur_width; +	}  }  class LLBottomTrayLite @@ -1094,58 +1114,131 @@ void LLBottomTray::setTrayButtonVisible(EResizeState shown_object_type, bool vis  	if (mDummiesMap.count(shown_object_type))  	{ -		mDummiesMap[shown_object_type]->setVisible(visible); +		// Hide/show layout panel for dummy icon. +		mDummiesMap[shown_object_type]->getParent()->setVisible(visible);  	}  }  void LLBottomTray::setTrayButtonVisibleIfPossible(EResizeState shown_object_type, bool visible, bool raise_notification)  { -	bool can_be_set = true; - -	if (visible) +	if (!setVisibleAndFitWidths(shown_object_type, visible) && visible && raise_notification)  	{ -		LLPanel* panel = mStateProcessedObjectMap[shown_object_type]; -		if (NULL == panel) -		{ -			lldebugs << "There is no object to process for state: " << shown_object_type << llendl; -			return; -		} +		LLNotificationsUtil::add("BottomTrayButtonCanNotBeShown", +								 LLSD(), +								 LLSD(), +								 LLNotificationFunctorRegistry::instance().DONOTHING); +	} +} -		const S32 dummy_width = mDummiesMap.count(shown_object_type) ? mDummiesMap[shown_object_type]->getRect().getWidth() : 0; +bool LLBottomTray::setVisibleAndFitWidths(EResizeState object_type, bool visible) +{ +	LLPanel* cur_panel = mStateProcessedObjectMap[object_type]; +	if (NULL == cur_panel) +	{ +		lldebugs << "There is no object to process for state: " << object_type << llendl; +		return false; +	} -		const S32 chatbar_panel_width = mNearbyChatBar->getRect().getWidth(); -		const S32 chatbar_panel_min_width = mNearbyChatBar->getMinWidth(); +	const S32 dummy_width = mDummiesMap.count(object_type) +		? mDummiesMap[object_type]->getParent()->getRect().getWidth() +		: 0; -		const S32 chiclet_panel_width = mChicletPanel->getParent()->getRect().getWidth(); -		const S32 chiclet_panel_min_width = mChicletPanel->getMinWidth(); +	bool is_set = true; -		const S32 available_width = (chatbar_panel_width - chatbar_panel_min_width) -			+ (chiclet_panel_width - chiclet_panel_min_width); +	if (visible) +	{ +		// Assume that only chiclet panel can be auto-resized and +		// don't take into account width of dummy widgets +		const S32 available_width = +			mChicletPanel->getParent()->getRect().getWidth() - +			mChicletPanel->getMinWidth() - +			dummy_width; + +		S32 preferred_width = mObjectDefaultWidthMap[object_type]; +		S32 current_width = cur_panel->getRect().getWidth(); +		S32 result_width = 0; +		bool decrease_width = false; + +		// Mark this button to be shown +		mResizeState |= object_type; + +		if (preferred_width > 0 && available_width >= preferred_width) +		{ +			result_width = preferred_width; +		} +		else if (available_width >= current_width) +		{ +			result_width = current_width; +		} +		else +		{ +			// Calculate the possible shrunk width as difference between current and minimal widths +			const S32 chatbar_shrunk_width = +				mNearbyChatBar->getRect().getWidth() - mNearbyChatBar->getMinWidth(); + +			const S32 sum_of_min_widths = +				get_panel_min_width(mToolbarStack, mStateProcessedObjectMap[RS_BUTTON_CAMERA])   + +				get_panel_min_width(mToolbarStack, mStateProcessedObjectMap[RS_BUTTON_MOVEMENT]) + +				get_panel_min_width(mToolbarStack, mStateProcessedObjectMap[RS_BUTTON_GESTURES]) + +				get_panel_min_width(mToolbarStack, mSpeakPanel); + +			const S32 sum_of_curr_widths = +				get_curr_width(mStateProcessedObjectMap[RS_BUTTON_CAMERA])   + +				get_curr_width(mStateProcessedObjectMap[RS_BUTTON_MOVEMENT]) + +				get_curr_width(mStateProcessedObjectMap[RS_BUTTON_GESTURES]) + +				get_curr_width(mSpeakPanel); + +			const S32 possible_shrunk_width = +				chatbar_shrunk_width + (sum_of_curr_widths - sum_of_min_widths); + +			// Minimal width of current panel +			S32 minimal_width = 0; +			mToolbarStack->getPanelMinSize(cur_panel->getName(), &minimal_width, NULL); + +			if ( (available_width + possible_shrunk_width) >= minimal_width) +			{ +				// There is enough space for minimal width, but set the result_width +				// to current_width so buttons widths decreasing will be done in predefined order +				result_width = current_width; +				decrease_width = true; +			} +			else +			{ +				// Nothing can be done, give up... +				return false; +			} +		} -		const S32 required_width = panel->getRect().getWidth() + dummy_width; -		can_be_set = available_width >= required_width; -	} +		if (result_width != current_width) +		{ +			cur_panel->reshape(result_width, cur_panel->getRect().getHeight()); +			current_width = result_width; +		} -	if (can_be_set) -	{ -		setTrayButtonVisible(shown_object_type, visible); +		is_set = processShowButton(object_type, ¤t_width); -		// if we hide the button mark it NOT to show while future bottom tray extending -		if (!visible) +		// Shrink buttons if needed +		if (is_set && decrease_width)  		{ -			mResizeState &= ~shown_object_type; +			processWidthDecreased( -result_width - dummy_width );  		}  	}  	else  	{ -		// mark this button to show it while future bottom tray extending -		mResizeState |= shown_object_type; -		if ( raise_notification ) -			LLNotificationsUtil::add("BottomTrayButtonCanNotBeShown", -									 LLSD(), -									 LLSD(), -									 LLNotificationFunctorRegistry::instance().DONOTHING); +		const S32 delta_width = get_curr_width(cur_panel); + +		setTrayButtonVisible(object_type, false); + +		// Mark button NOT to show while future bottom tray extending +		mResizeState &= ~object_type; + +		// Extend other buttons if need +		if (delta_width) +		{ +			processWidthIncreased(delta_width + dummy_width); +		}  	} +	return is_set;  }  //EOF diff --git a/indra/newview/llbottomtray.h b/indra/newview/llbottomtray.h index ee0eb13218..2eeb0c0017 100644 --- a/indra/newview/llbottomtray.h +++ b/indra/newview/llbottomtray.h @@ -173,6 +173,14 @@ private:  	 */  	void setTrayButtonVisibleIfPossible(EResizeState shown_object_type, bool visible, bool raise_notification = true); +	/** +	 * Sets passed visibility to required button and fit widths of shown +	 * buttons(notice that method can shrink widths to +	 * allocate needed room in bottom tray). +	 * Returns true if visibility of required button was set. +	 */ +	bool setVisibleAndFitWidths(EResizeState object_type, bool visible); +  	MASK mResizeState;  	typedef std::map<EResizeState, LLPanel*> state_object_map_t; diff --git a/indra/newview/llfolderview.cpp b/indra/newview/llfolderview.cpp index d053933dfb..888ddbcbc7 100644 --- a/indra/newview/llfolderview.cpp +++ b/indra/newview/llfolderview.cpp @@ -222,7 +222,7 @@ LLFolderView::LLFolderView(const Params& p)  	// Escape is handled by reverting the rename, not commiting it (default behavior)  	LLLineEditor::Params params;  	params.name("ren"); -	params.rect(getRect()); +	params.rect(rect);  	params.font(getLabelFontForStyle(LLFontGL::NORMAL));  	params.max_length_bytes(DB_INV_ITEM_NAME_STR_LEN);  	params.commit_callback.function(boost::bind(&LLFolderView::commitRename, this, _2)); @@ -234,13 +234,19 @@ LLFolderView::LLFolderView(const Params& p)  	// Textbox  	LLTextBox::Params text_p; -	LLRect new_r(5, 40, 300, 40-13); -	text_p.name(std::string(p.name)); +	LLFontGL* font = getLabelFontForStyle(mLabelStyle); +	LLRect new_r = LLRect(rect.mLeft + ICON_PAD, +						  rect.mTop - TEXT_PAD, +						  rect.mRight, +						  rect.mTop - TEXT_PAD - font->getLineHeight());  	text_p.rect(new_r); -	text_p.font(getLabelFontForStyle(mLabelStyle)); +	text_p.name(std::string(p.name)); +	text_p.font(font);  	text_p.visible(false);  	text_p.allow_html(true);  	mStatusTextBox = LLUICtrlFactory::create<LLTextBox> (text_p); +	mStatusTextBox->setFollowsLeft(); +	mStatusTextBox->setFollowsTop();  	//addChild(mStatusTextBox); diff --git a/indra/newview/llimfloater.cpp b/indra/newview/llimfloater.cpp index 8b2c5b039f..847695577a 100644 --- a/indra/newview/llimfloater.cpp +++ b/indra/newview/llimfloater.cpp @@ -497,7 +497,11 @@ void LLIMFloater::setVisible(BOOL visible)  	{  		//only if floater was construced and initialized from xml  		updateMessages(); -		mInputEditor->setFocus(TRUE); +		//prevent steal focus when IM opened in multitab mode +		if (!isChatMultiTab()) +		{ +			mInputEditor->setFocus(TRUE); +		}  	}  	if(!visible) diff --git a/indra/newview/skins/default/xui/en/notifications.xml b/indra/newview/skins/default/xui/en/notifications.xml index 0fbd860648..9c6b18ef27 100644 --- a/indra/newview/skins/default/xui/en/notifications.xml +++ b/indra/newview/skins/default/xui/en/notifications.xml @@ -2297,6 +2297,9 @@ Display settings have been set to recommended levels based on your system config     name="ErrorMessage"     type="alertmodal">  [ERROR_MESSAGE] +    <usetemplate +     name="okbutton" +     yestext="OK"/>    </notification>    <notification  | 
