diff options
| author | Merov Linden <merov@lindenlab.com> | 2012-07-31 23:47:16 -0700 | 
|---|---|---|
| committer | Merov Linden <merov@lindenlab.com> | 2012-07-31 23:47:16 -0700 | 
| commit | 2855e8bf8e91454e814cdd00985056830d8a8f5b (patch) | |
| tree | 83365da83a0ae620779e973e5ec9217707b5780e | |
| parent | e9a484f98d0376a5651d4f6eb5a692db4f77c800 (diff) | |
| parent | bc54fc2750c02ea11e8485efc541739a90d9cb3f (diff) | |
Pull from richard/viewer-chui
| -rw-r--r-- | indra/newview/llvoavatar.cpp | 316 | ||||
| -rw-r--r-- | indra/newview/skins/default/xui/en/notifications.xml | 6 | 
2 files changed, 164 insertions, 158 deletions
| diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index e5362261cf..2871b7b018 100644 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -3124,191 +3124,191 @@ void LLVOAvatar::idleUpdateNameTagText(BOOL new_name)  		{  			debugAvatarRezTime("AvatarRezLeftAppearanceNotification","left appearance mode");  		} +	} -		// Rebuild name tag if state change detected -		if (mNameString.empty() -			|| new_name -			|| (!title && !mTitle.empty()) -			|| (title && mTitle != title->getString()) -			|| is_away != mNameAway  -			|| is_busy != mNameBusy  -			|| is_muted != mNameMute -			|| is_appearance != mNameAppearance  -			|| is_friend != mNameFriend -			|| is_cloud != mNameCloud) -		{ -			LLColor4 name_tag_color = getNameTagColor(is_friend); +	// Rebuild name tag if state change detected +	if (mNameString.empty() +		|| new_name +		|| (!title && !mTitle.empty()) +		|| (title && mTitle != title->getString()) +		|| is_away != mNameAway  +		|| is_busy != mNameBusy  +		|| is_muted != mNameMute +		|| is_appearance != mNameAppearance  +		|| is_friend != mNameFriend +		|| is_cloud != mNameCloud) +	{ +		LLColor4 name_tag_color = getNameTagColor(is_friend); -			clearNameTag(); +		clearNameTag(); -			if (is_away || is_muted || is_busy || is_appearance) +		if (is_away || is_muted || is_busy || is_appearance) +		{ +			std::string line; +			if (is_away)  			{ -				std::string line; -				if (is_away) -				{ -					line += LLTrans::getString("AvatarAway"); -					line += ", "; -				} -				if (is_busy) -				{ -					line += LLTrans::getString("AvatarBusy"); -					line += ", "; -				} -				if (is_muted) -				{ -					line += LLTrans::getString("AvatarMuted"); -					line += ", "; -				} -				if (is_appearance) -				{ -					line += LLTrans::getString("AvatarEditingAppearance"); -					line += ", "; -				} -				if (is_cloud) -				{ -					line += LLTrans::getString("LoadingData"); -					line += ", "; -				} -				// trim last ", " -				line.resize( line.length() - 2 ); -				addNameTagLine(line, name_tag_color, LLFontGL::NORMAL, -					LLFontGL::getFontSansSerifSmall()); +				line += LLTrans::getString("AvatarAway"); +				line += ", ";  			} - -			if (sRenderGroupTitles -				&& title && title->getString() && title->getString()[0] != '\0') +			if (is_busy)  			{ -				std::string title_str = title->getString(); -				LLStringFn::replace_ascii_controlchars(title_str,LL_UNKNOWN_CHAR); -				addNameTagLine(title_str, name_tag_color, LLFontGL::NORMAL, -					LLFontGL::getFontSansSerifSmall()); +				line += LLTrans::getString("AvatarBusy"); +				line += ", ";  			} - -			static LLUICachedControl<bool> show_display_names("NameTagShowDisplayNames"); -			static LLUICachedControl<bool> show_usernames("NameTagShowUsernames"); - -			if (LLAvatarNameCache::useDisplayNames()) +			if (is_muted)  			{ -				LLAvatarName av_name; -				if (!LLAvatarNameCache::get(getID(), &av_name)) -				{ -					// ...call this function back when the name arrives -					// and force a rebuild -					LLAvatarNameCache::get(getID(), -						boost::bind(&LLVOAvatar::clearNameTag, this)); -				} - -				// Might be blank if name not available yet, that's OK -				if (show_display_names) -				{ -					addNameTagLine(av_name.mDisplayName, name_tag_color, LLFontGL::NORMAL, -						LLFontGL::getFontSansSerif()); -				} -				// Suppress SLID display if display name matches exactly (ugh) -				if (show_usernames && !av_name.mIsDisplayNameDefault) -				{ -					// *HACK: Desaturate the color -					LLColor4 username_color = name_tag_color * 0.83f; -					addNameTagLine(av_name.mUsername, username_color, LLFontGL::NORMAL, -						LLFontGL::getFontSansSerifSmall()); -				} +				line += LLTrans::getString("AvatarMuted"); +				line += ", ";  			} -			else +			if (is_appearance)  			{ -				const LLFontGL* font = LLFontGL::getFontSansSerif(); -				std::string full_name = LLCacheName::buildFullName( firstname->getString(), lastname->getString() ); -				addNameTagLine(full_name, name_tag_color, LLFontGL::NORMAL, font); +				line += LLTrans::getString("AvatarEditingAppearance"); +				line += ", ";  			} - -			mNameAway = is_away; -			mNameBusy = is_busy; -			mNameMute = is_muted; -			mNameAppearance = is_appearance; -			mNameFriend = is_friend; -			mNameCloud = is_cloud; -			mTitle = title ? title->getString() : ""; -			LLStringFn::replace_ascii_controlchars(mTitle,LL_UNKNOWN_CHAR); -			new_name = TRUE; +			if (is_cloud) +			{ +				line += LLTrans::getString("LoadingData"); +				line += ", "; +			} +			// trim last ", " +			line.resize( line.length() - 2 ); +			addNameTagLine(line, name_tag_color, LLFontGL::NORMAL, +				LLFontGL::getFontSansSerifSmall());  		} -		if (mVisibleChat) +		if (sRenderGroupTitles +			&& title && title->getString() && title->getString()[0] != '\0')  		{ -			mNameText->setFont(LLFontGL::getFontSansSerif()); -			mNameText->setTextAlignment(LLHUDNameTag::ALIGN_TEXT_LEFT); -			mNameText->setFadeDistance(CHAT_NORMAL_RADIUS * 2.f, 5.f); +			std::string title_str = title->getString(); +			LLStringFn::replace_ascii_controlchars(title_str,LL_UNKNOWN_CHAR); +			addNameTagLine(title_str, name_tag_color, LLFontGL::NORMAL, +				LLFontGL::getFontSansSerifSmall()); +		} -			char line[MAX_STRING];		/* Flawfinder: ignore */ -			line[0] = '\0'; -			std::deque<LLChat>::iterator chat_iter = mChats.begin(); -			mNameText->clearString(); +		static LLUICachedControl<bool> show_display_names("NameTagShowDisplayNames"); +		static LLUICachedControl<bool> show_usernames("NameTagShowUsernames"); -			LLColor4 new_chat = LLUIColorTable::instance().getColor( isSelf() ? "UserChatColor" : "AgentChatColor" ); -			LLColor4 normal_chat = lerp(new_chat, LLColor4(0.8f, 0.8f, 0.8f, 1.f), 0.7f); -			LLColor4 old_chat = lerp(normal_chat, LLColor4(0.6f, 0.6f, 0.6f, 1.f), 0.7f); -			if (mTyping && mChats.size() >= MAX_BUBBLE_CHAT_UTTERANCES)  +		if (LLAvatarNameCache::useDisplayNames()) +		{ +			LLAvatarName av_name; +			if (!LLAvatarNameCache::get(getID(), &av_name))  			{ -				++chat_iter; +				// ...call this function back when the name arrives +				// and force a rebuild +				LLAvatarNameCache::get(getID(), +					boost::bind(&LLVOAvatar::clearNameTag, this));  			} -			for(; chat_iter != mChats.end(); ++chat_iter) +			// Might be blank if name not available yet, that's OK +			if (show_display_names)  			{ -				F32 chat_fade_amt = llclamp((F32)((LLFrameTimer::getElapsedSeconds() - chat_iter->mTime) / CHAT_FADE_TIME), 0.f, 4.f); -				LLFontGL::StyleFlags style; -				switch(chat_iter->mChatType) -				{ -				case CHAT_TYPE_WHISPER: -					style = LLFontGL::ITALIC; -					break; -				case CHAT_TYPE_SHOUT: -					style = LLFontGL::BOLD; -					break; -				default: -					style = LLFontGL::NORMAL; -					break; -				} -				if (chat_fade_amt < 1.f) -				{ -					F32 u = clamp_rescale(chat_fade_amt, 0.9f, 1.f, 0.f, 1.f); -					mNameText->addLine(chat_iter->mText, lerp(new_chat, normal_chat, u), style); -				} -				else if (chat_fade_amt < 2.f) -				{ -					F32 u = clamp_rescale(chat_fade_amt, 1.9f, 2.f, 0.f, 1.f); -					mNameText->addLine(chat_iter->mText, lerp(normal_chat, old_chat, u), style); -				} -				else if (chat_fade_amt < 3.f) -				{ -					// *NOTE: only remove lines down to minimum number -					mNameText->addLine(chat_iter->mText, old_chat, style); -				} +				addNameTagLine(av_name.mDisplayName, name_tag_color, LLFontGL::NORMAL, +					LLFontGL::getFontSansSerif());  			} -			mNameText->setVisibleOffScreen(TRUE); - -			if (mTyping) +			// Suppress SLID display if display name matches exactly (ugh) +			if (show_usernames && !av_name.mIsDisplayNameDefault)  			{ -				S32 dot_count = (llfloor(mTypingTimer.getElapsedTimeF32() * 3.f) + 2) % 3 + 1; -				switch(dot_count) -				{ -				case 1: -					mNameText->addLine(".", new_chat); -					break; -				case 2: -					mNameText->addLine("..", new_chat); -					break; -				case 3: -					mNameText->addLine("...", new_chat); -					break; -				} - +				// *HACK: Desaturate the color +				LLColor4 username_color = name_tag_color * 0.83f; +				addNameTagLine(av_name.mUsername, username_color, LLFontGL::NORMAL, +					LLFontGL::getFontSansSerifSmall());  			}  		}  		else  		{ -			// ...not using chat bubbles, just names -			mNameText->setTextAlignment(LLHUDNameTag::ALIGN_TEXT_CENTER); -			mNameText->setFadeDistance(CHAT_NORMAL_RADIUS, 5.f); -			mNameText->setVisibleOffScreen(FALSE); +			const LLFontGL* font = LLFontGL::getFontSansSerif(); +			std::string full_name = LLCacheName::buildFullName( firstname->getString(), lastname->getString() ); +			addNameTagLine(full_name, name_tag_color, LLFontGL::NORMAL, font); +		} + +		mNameAway = is_away; +		mNameBusy = is_busy; +		mNameMute = is_muted; +		mNameAppearance = is_appearance; +		mNameFriend = is_friend; +		mNameCloud = is_cloud; +		mTitle = title ? title->getString() : ""; +		LLStringFn::replace_ascii_controlchars(mTitle,LL_UNKNOWN_CHAR); +		new_name = TRUE; +	} + +	if (mVisibleChat) +	{ +		mNameText->setFont(LLFontGL::getFontSansSerif()); +		mNameText->setTextAlignment(LLHUDNameTag::ALIGN_TEXT_LEFT); +		mNameText->setFadeDistance(CHAT_NORMAL_RADIUS * 2.f, 5.f); + +		char line[MAX_STRING];		/* Flawfinder: ignore */ +		line[0] = '\0'; +		std::deque<LLChat>::iterator chat_iter = mChats.begin(); +		mNameText->clearString(); + +		LLColor4 new_chat = LLUIColorTable::instance().getColor( isSelf() ? "UserChatColor" : "AgentChatColor" ); +		LLColor4 normal_chat = lerp(new_chat, LLColor4(0.8f, 0.8f, 0.8f, 1.f), 0.7f); +		LLColor4 old_chat = lerp(normal_chat, LLColor4(0.6f, 0.6f, 0.6f, 1.f), 0.7f); +		if (mTyping && mChats.size() >= MAX_BUBBLE_CHAT_UTTERANCES)  +		{ +			++chat_iter;  		} + +		for(; chat_iter != mChats.end(); ++chat_iter) +		{ +			F32 chat_fade_amt = llclamp((F32)((LLFrameTimer::getElapsedSeconds() - chat_iter->mTime) / CHAT_FADE_TIME), 0.f, 4.f); +			LLFontGL::StyleFlags style; +			switch(chat_iter->mChatType) +			{ +			case CHAT_TYPE_WHISPER: +				style = LLFontGL::ITALIC; +				break; +			case CHAT_TYPE_SHOUT: +				style = LLFontGL::BOLD; +				break; +			default: +				style = LLFontGL::NORMAL; +				break; +			} +			if (chat_fade_amt < 1.f) +			{ +				F32 u = clamp_rescale(chat_fade_amt, 0.9f, 1.f, 0.f, 1.f); +				mNameText->addLine(chat_iter->mText, lerp(new_chat, normal_chat, u), style); +			} +			else if (chat_fade_amt < 2.f) +			{ +				F32 u = clamp_rescale(chat_fade_amt, 1.9f, 2.f, 0.f, 1.f); +				mNameText->addLine(chat_iter->mText, lerp(normal_chat, old_chat, u), style); +			} +			else if (chat_fade_amt < 3.f) +			{ +				// *NOTE: only remove lines down to minimum number +				mNameText->addLine(chat_iter->mText, old_chat, style); +			} +		} +		mNameText->setVisibleOffScreen(TRUE); + +		if (mTyping) +		{ +			S32 dot_count = (llfloor(mTypingTimer.getElapsedTimeF32() * 3.f) + 2) % 3 + 1; +			switch(dot_count) +			{ +			case 1: +				mNameText->addLine(".", new_chat); +				break; +			case 2: +				mNameText->addLine("..", new_chat); +				break; +			case 3: +				mNameText->addLine("...", new_chat); +				break; +			} + +		} +	} +	else +	{ +		// ...not using chat bubbles, just names +		mNameText->setTextAlignment(LLHUDNameTag::ALIGN_TEXT_CENTER); +		mNameText->setFadeDistance(CHAT_NORMAL_RADIUS, 5.f); +		mNameText->setVisibleOffScreen(FALSE);  	}  } diff --git a/indra/newview/skins/default/xui/en/notifications.xml b/indra/newview/skins/default/xui/en/notifications.xml index f3d2762d3f..e85637826d 100644 --- a/indra/newview/skins/default/xui/en/notifications.xml +++ b/indra/newview/skins/default/xui/en/notifications.xml @@ -6413,6 +6413,7 @@ Your object named <nolink>[OBJECTFROMNAME]</nolink> has given you th     icon="notify.tga"     name="TeleportOffered"     log_to_im="true" +   log_to_chat="false"     type="offer">  [NAME_SLURL] has offered to teleport you to their location: @@ -6434,6 +6435,8 @@ Your object named <nolink>[OBJECTFROMNAME]</nolink> has given you th    <notification     icon="notify.tga"     name="TeleportOffered_MaturityExceeded" +   log_to_im="true" +   log_to_chat="false"     type="offer">  [NAME_SLURL] has offered to teleport you to their location: @@ -6457,6 +6460,8 @@ This region contains [REGION_CONTENT_MATURITY] content, but your current prefere    <notification     icon="notify.tga"     name="TeleportOffered_MaturityBlocked" +   log_to_im="true" +   log_to_chat="false"     type="notifytip">  [NAME_SLURL] has offered to teleport you to their location: @@ -6471,6 +6476,7 @@ However, this region contains content accessible to adults only.     icon="notify.tga"     name="TeleportOfferSent"     log_to_im="true" +   log_to_chat="false"     show_toast="false"     type="offer">  	Teleport offer sent to [TO_NAME] | 
