From fe2801fc63a428f47b29e151cfb71b4558305ceb Mon Sep 17 00:00:00 2001
From: Ricky Curtice <kf6kjg+hg@gmail.com>
Date: Mon, 3 Mar 2014 21:50:12 -0800
Subject: [PATCH] STORM-2017: Added translatable help text to rotation.
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

I chose the camera’s up vector to place the help text as it provided a consistent location on the screen for the user to see the text pop up.

While doing this I realized that the calls to hud_render_utf8text utilized a condition that was guaranteed to be false based on a surrounding if-statement, and so could trivially be replaced with a constant.
Also cleaned out a compiler warning about unused private member variables in llmaniptranslate.  I don’t like warnings and useless code. :P
---
 doc/contributions.txt              |  2 ++
 indra/newview/llmaniprotate.cpp    | 29 +++++++++++++++++++++++++++++
 indra/newview/llmanipscale.cpp     |  4 ++--
 indra/newview/llmaniptranslate.cpp |  6 ++----
 indra/newview/llmaniptranslate.h   |  2 --
 5 files changed, 35 insertions(+), 8 deletions(-)

diff --git a/doc/contributions.txt b/doc/contributions.txt
index 1f5da24f9c..6486291226 100755
--- a/doc/contributions.txt
+++ b/doc/contributions.txt
@@ -326,6 +326,8 @@ Cron Stardust
 	VWR-25120
 	STORM-1075
 	STORM-1919
+	STORM-1920
+	STORM-2017
 Cypren Christenson
 	STORM-417
 Dante Tucker
diff --git a/indra/newview/llmaniprotate.cpp b/indra/newview/llmaniprotate.cpp
index 4cbdfde868..bd21d04b4a 100755
--- a/indra/newview/llmaniprotate.cpp
+++ b/indra/newview/llmaniprotate.cpp
@@ -61,6 +61,7 @@
 #include "llglheaders.h"
 #include "lltrans.h"
 #include "llvoavatarself.h"
+#include "llhudrender.h"
 
 const F32 RADIUS_PIXELS = 100.f;		// size in screen space
 const F32 SQ_RADIUS = RADIUS_PIXELS * RADIUS_PIXELS;
@@ -452,6 +453,9 @@ BOOL LLManipRotate::handleMouseDownOnPart( S32 x, S32 y, MASK mask )
 	// Route future Mouse messages here preemptively.  (Release on mouse up.)
 	setMouseCapture( TRUE );
 	LLSelectMgr::getInstance()->enableSilhouette(FALSE);
+
+	mHelpTextTimer.reset();
+	sNumTimesHelpTextShown++;
 	return TRUE;
 }
 
@@ -1111,6 +1115,31 @@ void LLManipRotate::renderSnapGuides()
 			}
 		}
 	}
+
+
+	// render help text
+	if (mObjectSelection->getSelectType() != SELECT_TYPE_HUD)
+	{
+		if (mHelpTextTimer.getElapsedTimeF32() < sHelpTextVisibleTime + sHelpTextFadeTime && sNumTimesHelpTextShown < sMaxTimesShowHelpText)
+		{
+			LLVector3 selection_center_start = LLSelectMgr::getInstance()->getSavedBBoxOfSelection().getCenterAgent();
+
+			LLVector3 offset_dir = LLViewerCamera::getInstance()->getUpAxis();
+
+			F32 line_alpha = gSavedSettings.getF32("GridOpacity");
+
+			LLVector3 help_text_pos = selection_center_start + (mRadiusMeters * 3.f * offset_dir);
+			const LLFontGL* big_fontp = LLFontGL::getFontSansSerif();
+
+			std::string help_text =  LLTrans::getString("manip_hint1");
+			LLColor4 help_text_color = LLColor4::white;
+			help_text_color.mV[VALPHA] = clamp_rescale(mHelpTextTimer.getElapsedTimeF32(), sHelpTextVisibleTime, sHelpTextVisibleTime + sHelpTextFadeTime, line_alpha, 0.f);
+			hud_render_utf8text(help_text, help_text_pos, *big_fontp, LLFontGL::NORMAL, LLFontGL::NO_SHADOW, -0.5f * big_fontp->getWidthF32(help_text), 3.f, help_text_color, false);
+			help_text =  LLTrans::getString("manip_hint2");
+			help_text_pos -= offset_dir * mRadiusMeters * 0.4f;
+			hud_render_utf8text(help_text, help_text_pos, *big_fontp, LLFontGL::NORMAL, LLFontGL::NO_SHADOW, -0.5f * big_fontp->getWidthF32(help_text), 3.f, help_text_color, false);
+		}
+	}
 }
 
 // Returns TRUE if center of sphere is visible.  Also sets a bunch of member variables that are used later (e.g. mCenterToCam)
diff --git a/indra/newview/llmanipscale.cpp b/indra/newview/llmanipscale.cpp
index aa4386508b..6c1b25f2b4 100755
--- a/indra/newview/llmanipscale.cpp
+++ b/indra/newview/llmanipscale.cpp
@@ -1877,10 +1877,10 @@ void LLManipScale::renderSnapGuides(const LLBBox& bbox)
 				std::string help_text = LLTrans::getString("manip_hint1");
 				LLColor4 help_text_color = LLColor4::white;
 				help_text_color.mV[VALPHA] = clamp_rescale(mHelpTextTimer.getElapsedTimeF32(), sHelpTextVisibleTime, sHelpTextVisibleTime + sHelpTextFadeTime, grid_alpha, 0.f);
-				hud_render_utf8text(help_text, help_text_pos, *big_fontp, LLFontGL::NORMAL, LLFontGL::NO_SHADOW, -0.5f * big_fontp->getWidthF32(help_text), 3.f, help_text_color, mObjectSelection->getSelectType() == SELECT_TYPE_HUD);
+				hud_render_utf8text(help_text, help_text_pos, *big_fontp, LLFontGL::NORMAL, LLFontGL::NO_SHADOW, -0.5f * big_fontp->getWidthF32(help_text), 3.f, help_text_color, false);
 				help_text = LLTrans::getString("manip_hint2");
 				help_text_pos -= LLViewerCamera::getInstance()->getUpAxis() * mSnapRegimeOffset * 0.4f;
-				hud_render_utf8text(help_text, help_text_pos, *big_fontp, LLFontGL::NORMAL, LLFontGL::NO_SHADOW, -0.5f * big_fontp->getWidthF32(help_text), 3.f, help_text_color, mObjectSelection->getSelectType() == SELECT_TYPE_HUD);
+				hud_render_utf8text(help_text, help_text_pos, *big_fontp, LLFontGL::NORMAL, LLFontGL::NO_SHADOW, -0.5f * big_fontp->getWidthF32(help_text), 3.f, help_text_color, false);
 			}
 		}
 	}
diff --git a/indra/newview/llmaniptranslate.cpp b/indra/newview/llmaniptranslate.cpp
index e84207461c..d237e5ef44 100755
--- a/indra/newview/llmaniptranslate.cpp
+++ b/indra/newview/llmaniptranslate.cpp
@@ -112,7 +112,6 @@ LLManipTranslate::LLManipTranslate( LLToolComposite* composite )
 :	LLManip( std::string("Move"), composite ),
 	mLastHoverMouseX(-1),
 	mLastHoverMouseY(-1),
-	mSendUpdateOnMouseUp(FALSE),
 	mMouseOutsideSlop(FALSE),
 	mCopyMadeThisDrag(FALSE),
 	mMouseDownX(-1),
@@ -126,7 +125,6 @@ LLManipTranslate::LLManipTranslate( LLToolComposite* composite )
 	mSnapOffsetMeters(0.f),
 	mSubdivisions(10.f),
 	mInSnapRegime(FALSE),
-	mSnapped(FALSE),
 	mArrowScales(1.f, 1.f, 1.f),
 	mPlaneScales(1.f, 1.f, 1.f),
 	mPlaneManipPositions(1.f, 1.f, 1.f, 1.f)
@@ -1445,10 +1443,10 @@ void LLManipTranslate::renderSnapGuides()
 				std::string help_text = LLTrans::getString("manip_hint1");
 				LLColor4 help_text_color = LLColor4::white;
 				help_text_color.mV[VALPHA] = clamp_rescale(mHelpTextTimer.getElapsedTimeF32(), sHelpTextVisibleTime, sHelpTextVisibleTime + sHelpTextFadeTime, line_alpha, 0.f);
-				hud_render_utf8text(help_text, help_text_pos, *big_fontp, LLFontGL::NORMAL, LLFontGL::NO_SHADOW, -0.5f * big_fontp->getWidthF32(help_text), 3.f, help_text_color, mObjectSelection->getSelectType() == SELECT_TYPE_HUD);
+				hud_render_utf8text(help_text, help_text_pos, *big_fontp, LLFontGL::NORMAL, LLFontGL::NO_SHADOW, -0.5f * big_fontp->getWidthF32(help_text), 3.f, help_text_color, false);
 				help_text = LLTrans::getString("manip_hint2");
 				help_text_pos -= LLViewerCamera::getInstance()->getUpAxis() * mSnapOffsetMeters * 0.2f;
-				hud_render_utf8text(help_text, help_text_pos, *big_fontp, LLFontGL::NORMAL, LLFontGL::NO_SHADOW, -0.5f * big_fontp->getWidthF32(help_text), 3.f, help_text_color, mObjectSelection->getSelectType() == SELECT_TYPE_HUD);
+				hud_render_utf8text(help_text, help_text_pos, *big_fontp, LLFontGL::NORMAL, LLFontGL::NO_SHADOW, -0.5f * big_fontp->getWidthF32(help_text), 3.f, help_text_color, false);
 			}
 		}
 	}
diff --git a/indra/newview/llmaniptranslate.h b/indra/newview/llmaniptranslate.h
index 37567c7bd1..3c37bbd698 100755
--- a/indra/newview/llmaniptranslate.h
+++ b/indra/newview/llmaniptranslate.h
@@ -85,7 +85,6 @@ protected:
 private:
 	S32			mLastHoverMouseX;
 	S32			mLastHoverMouseY;
-	BOOL		mSendUpdateOnMouseUp;
 	BOOL		mMouseOutsideSlop;		// true after mouse goes outside slop region
 	BOOL		mCopyMadeThisDrag;
 	S32			mMouseDownX;
@@ -107,7 +106,6 @@ private:
 	LLVector3	mGridScale;
 	F32			mSubdivisions;
 	BOOL		mInSnapRegime;
-	BOOL		mSnapped;
 	LLVector3	mArrowScales;
 	LLVector3	mPlaneScales;
 	LLVector4	mPlaneManipPositions;
-- 
GitLab