diff options
| author | James Cook <james@lindenlab.com> | 2009-11-24 08:35:47 -0800 | 
|---|---|---|
| committer | James Cook <james@lindenlab.com> | 2009-11-24 08:35:47 -0800 | 
| commit | 0b3f6b3e9a1414c11ccf6011930c2eec6cf2fdd7 (patch) | |
| tree | d4d83f4347fe6a56931a97a3eedabb97bdcfefff | |
| parent | 156ced177d22623f0b5291f043636b7d32f69470 (diff) | |
| parent | 6634d3c1ccbe13d3c0cdd17b60628eabe633ea7d (diff) | |
Automated merge with ssh://hg.lindenlab.com/james/gooey/
| -rw-r--r-- | indra/llui/lllineeditor.cpp | 13 | ||||
| -rw-r--r-- | indra/llui/lllineeditor.h | 3 | ||||
| -rw-r--r-- | indra/newview/app_settings/settings.xml | 13 | ||||
| -rw-r--r-- | indra/newview/llgroupmgr.cpp | 1 | ||||
| -rw-r--r-- | indra/newview/lllocationinputctrl.cpp | 167 | ||||
| -rw-r--r-- | indra/newview/lllocationinputctrl.h | 7 | ||||
| -rw-r--r-- | indra/newview/llpanelobjectinventory.cpp | 1 | ||||
| -rw-r--r-- | indra/newview/llstatusbar.h | 1 | ||||
| -rw-r--r-- | indra/newview/skins/default/xui/en/menu_navbar.xml | 17 | ||||
| -rw-r--r-- | indra/newview/skins/default/xui/en/widgets/location_input.xml | 12 | 
10 files changed, 169 insertions, 66 deletions
| diff --git a/indra/llui/lllineeditor.cpp b/indra/llui/lllineeditor.cpp index 406c77a365..bd5734312a 100644 --- a/indra/llui/lllineeditor.cpp +++ b/indra/llui/lllineeditor.cpp @@ -323,6 +323,19 @@ void LLLineEditor::setMaxTextLength(S32 max_text_length)  	mMaxLengthBytes = max_len;  }  +void LLLineEditor::getTextPadding(S32 *left, S32 *right) +{ +	*left = mTextPadLeft; +	*right = mTextPadRight; +} + +void LLLineEditor::setTextPadding(S32 left, S32 right) +{ +	mTextPadLeft = left; +	mTextPadRight = right; +	updateTextPadding(); +} +  void LLLineEditor::updateTextPadding()  {  	static LLUICachedControl<S32> line_editor_hpad ("UILineEditorHPad", 0); diff --git a/indra/llui/lllineeditor.h b/indra/llui/lllineeditor.h index 4474963b1a..4c4b00094d 100644 --- a/indra/llui/lllineeditor.h +++ b/indra/llui/lllineeditor.h @@ -226,6 +226,9 @@ public:  	void			setKeystrokeCallback(callback_t callback, void* user_data);  	void			setMaxTextLength(S32 max_text_length); +	// Manipulate left and right padding for text +	void getTextPadding(S32 *left, S32 *right); +	void setTextPadding(S32 left, S32 right);  	// Prevalidation controls which keystrokes can affect the editor  	void			setPrevalidate( LLLinePrevalidateFunc func ); diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index 21ccf2ac91..85a465c073 100644 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -7712,7 +7712,7 @@      <key>NavBarShowCoordinates</key>      <map>        <key>Comment</key> -      <string>Show Coordinates in  Location Input Field</string> +      <string>Show coordinates in navigation bar</string>        <key>Persist</key>        <integer>1</integer>        <key>Type</key> @@ -7720,6 +7720,17 @@        <key>Value</key>        <integer>0</integer>      </map> +    <key>NavBarShowParcelProperties</key> +    <map> +      <key>Comment</key> +      <string>Show parcel property icons in navigation bar</string> +      <key>Persist</key> +      <integer>1</integer> +      <key>Type</key> +      <string>Boolean</string> +      <key>Value</key> +      <integer>1</integer> +    </map>      <key>ShowCrosshairs</key>      <map>        <key>Comment</key> diff --git a/indra/newview/llgroupmgr.cpp b/indra/newview/llgroupmgr.cpp index 0626a5c3d3..59537c1e65 100644 --- a/indra/newview/llgroupmgr.cpp +++ b/indra/newview/llgroupmgr.cpp @@ -52,6 +52,7 @@  #include "llviewerwindow.h"  #include "llpanelgroup.h"  #include "llgroupactions.h" +#include "llnotifications.h"  #include "lluictrlfactory.h"  #include <boost/regex.hpp> diff --git a/indra/newview/lllocationinputctrl.cpp b/indra/newview/lllocationinputctrl.cpp index be96d7b43a..063e98a811 100644 --- a/indra/newview/lllocationinputctrl.cpp +++ b/indra/newview/lllocationinputctrl.cpp @@ -52,6 +52,7 @@  #include "llteleporthistory.h"  #include "llsidetray.h"  #include "llslurl.h" +#include "llstatusbar.h"			// getHealth()  #include "lltrans.h"  #include "llviewerinventory.h"  #include "llviewerparcelmgr.h" @@ -165,7 +166,8 @@ LLLocationInputCtrl::Params::Params()  	push_icon("push_icon"),  	build_icon("build_icon"),  	scripts_icon("scripts_icon"), -	damage_icon("damage_icon") +	damage_icon("damage_icon"), +	damage_text("damage_text")  {  } @@ -200,7 +202,7 @@ LLLocationInputCtrl::LLLocationInputCtrl(const LLLocationInputCtrl::Params& p)  	params.commit_on_focus_lost(false);  	params.follows.flags(FOLLOWS_ALL);  	mTextEntry = LLUICtrlFactory::create<LLURLLineEditor>(params); -	this->addChild(mTextEntry); +	addChild(mTextEntry);  	// LLLineEditor is replaced with LLLocationLineEditor  	// "Place information" button. @@ -261,7 +263,10 @@ LLLocationInputCtrl::LLLocationInputCtrl(const LLLocationInputCtrl::Params& p)  	LLIconCtrl::Params damage_icon = p.damage_icon;  	mParcelIcon[DAMAGE_ICON] = LLUICtrlFactory::create<LLIconCtrl>(damage_icon);  	addChild(mParcelIcon[DAMAGE_ICON]); -	// TODO: health number? +	 +	LLTextBox::Params damage_text = p.damage_text; +	mDamageText = LLUICtrlFactory::create<LLTextBox>(damage_text); +	addChild(mDamageText);  	// Register callbacks and load the location field context menu (NB: the order matters).  	LLUICtrl::CommitCallbackRegistry::currentRegistrar().add("Navbar.Action", boost::bind(&LLLocationInputCtrl::onLocationContextMenuItemClicked, this, _2)); @@ -405,11 +410,8 @@ void LLLocationInputCtrl::onTextEntry(LLLineEditor* line_editor)   */  void LLLocationInputCtrl::setText(const LLStringExplicit& text)  { -	if (mTextEntry) -	{ -		mTextEntry->setText(text); -		mHasAutocompletedText = FALSE; -	} +	mTextEntry->setText(text); +	mHasAutocompletedText = FALSE;  }  void LLLocationInputCtrl::setFocus(BOOL b) @@ -444,10 +446,18 @@ void LLLocationInputCtrl::onFocusLost()  }  void LLLocationInputCtrl::draw() -{	 -	if(!hasFocus() && gSavedSettings.getBOOL("NavBarShowCoordinates")){ +{ +	static LLUICachedControl<bool> show_coords("NavBarShowCoordinates", false); +	if(!hasFocus() && show_coords) +	{  		refreshLocation();  	} +	 +	static LLUICachedControl<bool> show_icons("NavBarShowParcelProperties", false); +	if (show_icons) +	{ +		refreshHealth(); +	}  	LLComboBox::draw();  } @@ -544,10 +554,12 @@ void LLLocationInputCtrl::onLocationPrearrange(const LLSD& data)  	mList->mouseOverHighlightNthItem(-1); // Clear highlight on the last selected item.  } +  bool LLLocationInputCtrl::findTeleportItemsByTitle(const LLTeleportHistoryItem& item, const std::string& filter)  {  	return item.mTitle.find(filter) != std::string::npos;  } +  void LLLocationInputCtrl::onTextEditorRightClicked(S32 x, S32 y, MASK mask)  {  	if (mLocationContextMenu) @@ -596,41 +608,82 @@ void LLLocationInputCtrl::refreshLocation()  void LLLocationInputCtrl::refreshParcelIcons()  { -	LLViewerParcelMgr* vpm = LLViewerParcelMgr::getInstance(); -	// *TODO buy -	//bool allow_buy      = vpm->canAgentBuyParcel( vpm->getAgentParcel(), false); -	bool allow_voice	= vpm->allowAgentVoice(); -	bool allow_fly		= vpm->allowAgentFly(); -	bool allow_push		= vpm->allowAgentPush(); -	bool allow_build	= vpm->allowAgentBuild(); -	bool allow_scripts	= vpm->allowAgentScripts(); -	bool allow_damage	= vpm->allowAgentDamage(); - -	// Most icons are "block this ability" -	mParcelIcon[VOICE_ICON]->setVisible(   !allow_voice ); -	mParcelIcon[FLY_ICON]->setVisible(     !allow_fly ); -	mParcelIcon[PUSH_ICON]->setVisible(    !allow_push ); -	mParcelIcon[BUILD_ICON]->setVisible(   !allow_build ); -	mParcelIcon[SCRIPTS_ICON]->setVisible( !allow_scripts ); -	mParcelIcon[DAMAGE_ICON]->setVisible(  allow_damage ); -	// *TODO damage meter - -	// Slide the parcel icons rect from right to left, adjusting rectangles of -	// visible icons.  Assumes all icon rects are the same. -	LLRect icon_rect = mParcelIcon[0]->getRect(); -	S32 icon_width = icon_rect.getWidth(); -	icon_rect.mRight = mAddLandmarkBtn->getRect().mLeft - mIconHPad; -	icon_rect.mLeft = icon_rect.mRight - icon_width; +	// Our "cursor" moving right to left +	S32 x = mAddLandmarkBtn->getRect().mLeft - mIconHPad; -	for (S32 i = 0; i < ICON_COUNT; ++i) +	static LLUICachedControl<bool> show_properties("NavBarShowParcelProperties", false); +	if (show_properties) +	{ +		LLViewerParcelMgr* vpm = LLViewerParcelMgr::getInstance(); +		// *TODO buy +		//bool allow_buy      = vpm->canAgentBuyParcel( vpm->getAgentParcel(), false); +		bool allow_voice	= vpm->allowAgentVoice(); +		bool allow_fly		= vpm->allowAgentFly(); +		bool allow_push		= vpm->allowAgentPush(); +		bool allow_build	= vpm->allowAgentBuild(); +		bool allow_scripts	= vpm->allowAgentScripts(); +		bool allow_damage	= vpm->allowAgentDamage(); +		 +		// Most icons are "block this ability" +		mParcelIcon[VOICE_ICON]->setVisible(   !allow_voice ); +		mParcelIcon[FLY_ICON]->setVisible(     !allow_fly ); +		mParcelIcon[PUSH_ICON]->setVisible(    !allow_push ); +		mParcelIcon[BUILD_ICON]->setVisible(   !allow_build ); +		mParcelIcon[SCRIPTS_ICON]->setVisible( !allow_scripts ); +		mParcelIcon[DAMAGE_ICON]->setVisible(  allow_damage ); +		mDamageText->setVisible(allow_damage); +		 +		// Slide the parcel icons rect from right to left, adjusting rectangles of +		// visible icons.  Assumes all icon rects are the same. +		for (S32 i = 0; i < ICON_COUNT; ++i) +		{ +			LLIconCtrl* icon = mParcelIcon[i]; +			if (icon->getVisible()) +			{ +				LLRect r = icon->getRect(); +				r.mLeft = x - r.getWidth(); +				r.mRight = x; +				icon->setRect( r ); +				x -= r.getWidth() + mIconHPad; +			} +		} +		LLRect text_rect = mDamageText->getRect(); +		text_rect.mLeft = x - text_rect.getWidth(); +		text_rect.mRight = x; +		mDamageText->setRect(text_rect); +		x -= text_rect.getWidth() + mIconHPad; +	} +	else  	{ -		if (mParcelIcon[i]->getVisible()) +		for (S32 i = 0; i < ICON_COUNT; ++i)  		{ -			mParcelIcon[i]->setRect( icon_rect ); -			icon_rect.translate( -icon_width - mIconHPad, 0); +			mParcelIcon[i]->setVisible(false); +		} +		mDamageText->setVisible(false); +	} +	 +	S32 left_pad, right_pad; +	mTextEntry->getTextPadding(&left_pad, &right_pad); +	right_pad = mTextEntry->getRect().mRight - x; +	llinfos << "JAMESDEBUG text entry rect " << mTextEntry->getRect() +	<< " x " << x << " left_pad " << left_pad << " right_pad " << right_pad << llendl; +	mTextEntry->setTextPadding(left_pad, right_pad); +} + +void LLLocationInputCtrl::refreshHealth() +{ +	// *FIXME: Status bar owns health information, should be in agent +	if (gStatusBar) +	{ +		static S32 last_health = -1; +		S32 health = gStatusBar->getHealth(); +		if (health != last_health) +		{ +			std::string text = llformat("%d%%", health); +			mDamageText->setText(text); +			last_health = health;  		}  	} -	// *TODO: health meter  }  void LLLocationInputCtrl::rebuildLocationHistory(std::string filter) @@ -754,11 +807,17 @@ void LLLocationInputCtrl::onLocationContextMenuItemClicked(const LLSD& userdata)  {  	std::string item = userdata.asString(); -	if (item == std::string("show_coordinates")) +	if (item == "show_coordinates")  	{  		gSavedSettings.setBOOL("NavBarShowCoordinates",!gSavedSettings.getBOOL("NavBarShowCoordinates"));  	} -	else if (item == std::string("landmark")) +	else if (item == "show_properties") +	{ +		gSavedSettings.setBOOL("NavBarShowParcelProperties", +			!gSavedSettings.getBOOL("NavBarShowParcelProperties")); +		refreshParcelIcons(); +	} +	else if (item == "landmark")  	{  		LLViewerInventoryItem* landmark = LLLandmarkActions::findLandmarkForAgentPos(); @@ -772,23 +831,23 @@ void LLLocationInputCtrl::onLocationContextMenuItemClicked(const LLSD& userdata)  					LLSD().insert("type", "landmark").insert("id",landmark->getUUID()));  		}  	} -	else if (item == std::string("cut")) +	else if (item == "cut")  	{  		mTextEntry->cut();  	} -	else if (item == std::string("copy")) +	else if (item == "copy")  	{  		mTextEntry->copy();  	} -	else if (item == std::string("paste")) +	else if (item == "paste")  	{  		mTextEntry->paste();  	} -	else if (item == std::string("delete")) +	else if (item == "delete")  	{  		mTextEntry->deleteSelection();  	} -	else if (item == std::string("select_all")) +	else if (item == "select_all")  	{  		mTextEntry->selectAll();  	} @@ -798,28 +857,28 @@ bool LLLocationInputCtrl::onLocationContextMenuItemEnabled(const LLSD& userdata)  {  	std::string item = userdata.asString(); -	if (item == std::string("can_cut")) +	if (item == "can_cut")  	{  		return mTextEntry->canCut();  	} -	else if (item == std::string("can_copy")) +	else if (item == "can_copy")  	{  		return mTextEntry->canCopy();  	} -	else if (item == std::string("can_paste")) +	else if (item == "can_paste")  	{  		return mTextEntry->canPaste();  	} -	else if (item == std::string("can_delete")) +	else if (item == "can_delete")  	{  		return mTextEntry->canDeselect();  	} -	else if (item == std::string("can_select_all")) +	else if (item == "can_select_all")  	{  		return mTextEntry->canSelectAll();  	} -	else if(item == std::string("show_coordinates")){ -	 +	else if(item == "show_coordinates") +	{  		return gSavedSettings.getBOOL("NavBarShowCoordinates");  	} diff --git a/indra/newview/lllocationinputctrl.h b/indra/newview/lllocationinputctrl.h index fefd0f7fec..3bd23e80a9 100644 --- a/indra/newview/lllocationinputctrl.h +++ b/indra/newview/lllocationinputctrl.h @@ -35,6 +35,7 @@  #include "llcombobox.h"  #include "lliconctrl.h"		// Params +#include "lltextbox.h"		// Params  class LLLandmark; @@ -73,6 +74,7 @@ public:  											build_icon,  											scripts_icon,  											damage_icon; +		Optional<LLTextBox::Params>			damage_text;  		Params();  	}; @@ -111,6 +113,9 @@ private:  	void					refresh();  	void					refreshLocation();  	void					refreshParcelIcons(); +	// Refresh the value in the health percentage text field +	void					refreshHealth(); +	  	void					rebuildLocationHistory(std::string filter = "");  	bool 					findTeleportItemsByTitle(const LLTeleportHistoryItem& item, const std::string& filter);  	void					setText(const LLStringExplicit& text); @@ -147,7 +152,7 @@ private:  		ICON_COUNT  	};  	LLIconCtrl*	mParcelIcon[ICON_COUNT]; -	// TODO: Health meter? +	LLTextBox* mDamageText;  	LLAddLandmarkObserver*		mAddLandmarkObserver;  	LLRemoveLandmarkObserver*	mRemoveLandmarkObserver; diff --git a/indra/newview/llpanelobjectinventory.cpp b/indra/newview/llpanelobjectinventory.cpp index dbe0ec3b86..4237681c80 100644 --- a/indra/newview/llpanelobjectinventory.cpp +++ b/indra/newview/llpanelobjectinventory.cpp @@ -41,6 +41,7 @@  #include "llpanelobjectinventory.h" +#include "llmenugl.h"  #include "roles_constants.h"  #include "llagent.h" diff --git a/indra/newview/llstatusbar.h b/indra/newview/llstatusbar.h index 3ce3549961..bdaacce981 100644 --- a/indra/newview/llstatusbar.h +++ b/indra/newview/llstatusbar.h @@ -34,7 +34,6 @@  #define LL_LLSTATUSBAR_H  #include "llpanel.h" -#include <llmenugl.h>  // "Constants" loaded from settings.xml at start time  extern S32 STATUS_BAR_HEIGHT; diff --git a/indra/newview/skins/default/xui/en/menu_navbar.xml b/indra/newview/skins/default/xui/en/menu_navbar.xml index 89469fb013..e17eeb46f6 100644 --- a/indra/newview/skins/default/xui/en/menu_navbar.xml +++ b/indra/newview/skins/default/xui/en/menu_navbar.xml @@ -10,7 +10,6 @@   width="128">      <menu_item_check           label="Show Coordinates" -         layout="topleft"           name="Show Coordinates">             <menu_item_check.on_click               function="Navbar.Action" @@ -19,22 +18,28 @@               function="Navbar.EnableMenuItem"               parameter="show_coordinates" />      </menu_item_check> +    <menu_item_check +      label="Show Parcel Properties" +      name="Show Parcel Properties"> +      <menu_item_check.on_click +        function="Navbar.Action" +        parameter="show_properties" /> +      <menu_item_check.on_check +        control="NavBarShowParcelProperties" /> +    </menu_item_check>      <!-- Label of 'Landmark' item is changing in runtime,       see  AddLandmarkNavBarMenu/EditLandmarkNavBarMenu in strings.xml -->      <menu_item_call       label="Landmark" -     layout="topleft"       name="Landmark">          <menu_item_call.on_click           function="Navbar.Action"           parameter="landmark" />      </menu_item_call>      <menu_item_separator -     layout="topleft"       name="Separator" />      <menu_item_call       label="Cut" -     layout="topleft"       name="Cut">          <menu_item_call.on_click           function="Navbar.Action" @@ -45,7 +50,6 @@      </menu_item_call>      <menu_item_call       label="Copy" -     layout="topleft"       name="Copy">          <menu_item_call.on_click           function="Navbar.Action" @@ -56,7 +60,6 @@      </menu_item_call>      <menu_item_call       label="Paste" -     layout="topleft"       name="Paste">          <menu_item_call.on_click           function="Navbar.Action" @@ -67,7 +70,6 @@      </menu_item_call>      <menu_item_call       label="Delete" -     layout="topleft"       name="Delete">          <menu_item_call.on_click           function="Navbar.Action" @@ -78,7 +80,6 @@      </menu_item_call>      <menu_item_call       label="Select All" -     layout="topleft"       name="Select All">          <menu_item_call.on_click           function="Navbar.Action" diff --git a/indra/newview/skins/default/xui/en/widgets/location_input.xml b/indra/newview/skins/default/xui/en/widgets/location_input.xml index 1fed1c075a..17b1479ec4 100644 --- a/indra/newview/skins/default/xui/en/widgets/location_input.xml +++ b/indra/newview/skins/default/xui/en/widgets/location_input.xml @@ -81,8 +81,18 @@  	top="21"      image_name="parcel_lght_Damage"      /> +  <!-- Default text color is invisible on top of nav bar background --> +  <damage_text +    name="damage_text" +	width="50" +	height="18" +	top="16" +	halign="right" +	font="SansSerifSmall" +	text_color="TextFgColor" +	/> -    <combo_button name="Location History" +  <combo_button name="Location History"                            label=""                            pad_right="0"/>    <combo_list bg_writeable_color="MenuDefaultBgColor" page_lines="10" | 
