diff options
author | Andrey Lihatskiy <alihatskiy@productengine.com> | 2024-05-15 12:06:42 +0300 |
---|---|---|
committer | Andrey Lihatskiy <alihatskiy@productengine.com> | 2024-05-15 12:07:29 +0300 |
commit | dcb85f9f9d1019bb046a5719bc3645fa96a2d060 (patch) | |
tree | 2a75406ca1ab8d15e88066dfdc7440c93d0d7c63 /indra/newview/llhudnametag.h | |
parent | 26f70456d1e9059c48d25e08fc07f893315b1f3c (diff) | |
parent | e7eced3c87310b15ac20cc3cd470d67686104a14 (diff) |
Merge branch 'marchcat/w-whitespace' into release/maint-c
Diffstat (limited to 'indra/newview/llhudnametag.h')
-rw-r--r-- | indra/newview/llhudnametag.h | 248 |
1 files changed, 124 insertions, 124 deletions
diff --git a/indra/newview/llhudnametag.h b/indra/newview/llhudnametag.h index 592ab5518f..36d774cccf 100644 --- a/indra/newview/llhudnametag.h +++ b/indra/newview/llhudnametag.h @@ -1,4 +1,4 @@ -/** +/** * @file llhudnametag.h * @brief Name tags for avatars * @author James Cook @@ -6,21 +6,21 @@ * $LicenseInfo:firstyear=2010&license=viewerlgpl$ * Second Life Viewer Source Code * Copyright (C) 2010, Linden Research, Inc. - * + * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; * version 2.1 of the License only. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. - * + * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * + * * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA * $/LicenseInfo$ */ @@ -45,57 +45,57 @@ class LLUIImage; struct llhudnametag_further_away { - bool operator()(const LLPointer<LLHUDNameTag>& lhs, const LLPointer<LLHUDNameTag>& rhs) const; + bool operator()(const LLPointer<LLHUDNameTag>& lhs, const LLPointer<LLHUDNameTag>& rhs) const; }; class LLHUDNameTag : public LLHUDObject { protected: - class LLHUDTextSegment - { - public: - LLHUDTextSegment(const LLWString& text, const LLFontGL::StyleFlags style, const LLColor4& color, const LLFontGL* font) - : mColor(color), - mStyle(style), - mText(text), - mFont(font) - {} - F32 getWidth(const LLFontGL* font); - const LLWString& getText() const { return mText; } - void clearFontWidthMap() { mFontWidthMap.clear(); } - - LLColor4 mColor; - LLFontGL::StyleFlags mStyle; - const LLFontGL* mFont; - private: - LLWString mText; - std::map<const LLFontGL*, F32> mFontWidthMap; - }; + class LLHUDTextSegment + { + public: + LLHUDTextSegment(const LLWString& text, const LLFontGL::StyleFlags style, const LLColor4& color, const LLFontGL* font) + : mColor(color), + mStyle(style), + mText(text), + mFont(font) + {} + F32 getWidth(const LLFontGL* font); + const LLWString& getText() const { return mText; } + void clearFontWidthMap() { mFontWidthMap.clear(); } + + LLColor4 mColor; + LLFontGL::StyleFlags mStyle; + const LLFontGL* mFont; + private: + LLWString mText; + std::map<const LLFontGL*, F32> mFontWidthMap; + }; public: - typedef enum e_text_alignment - { - ALIGN_TEXT_LEFT, - ALIGN_TEXT_CENTER - } ETextAlignment; - - typedef enum e_vert_alignment - { - ALIGN_VERT_TOP, - ALIGN_VERT_CENTER - } EVertAlignment; + typedef enum e_text_alignment + { + ALIGN_TEXT_LEFT, + ALIGN_TEXT_CENTER + } ETextAlignment; + + typedef enum e_vert_alignment + { + ALIGN_VERT_TOP, + ALIGN_VERT_CENTER + } EVertAlignment; static const F32 NAMETAG_MAX_WIDTH; // 298px, made to fit 31 M's static const F32 HUD_TEXT_MAX_WIDTH; // 190px public: - // Set entire string, eliminating existing lines - void setString(const std::string& text_utf8); + // Set entire string, eliminating existing lines + void setString(const std::string& text_utf8); - void clearString(); + void clearString(); - // Add text a line at a time, allowing custom formatting - void addLine( + // Add text a line at a time, allowing custom formatting + void addLine( const std::string &text_utf8, const LLColor4& color, const LLFontGL::StyleFlags style = LLFontGL::NORMAL, @@ -103,93 +103,93 @@ public: const bool use_ellipses = false, F32 max_pixels = HUD_TEXT_MAX_WIDTH); - // For bubble chat, set the part above the chat text - void setLabel(const std::string& label_utf8); - void addLabel(const std::string& label_utf8, F32 max_pixels = HUD_TEXT_MAX_WIDTH); - - // Sets the default font for lines with no font specified - void setFont(const LLFontGL* font); - void setColor(const LLColor4 &color); - void setAlpha(F32 alpha); - void setZCompare(const BOOL zcompare); - void setDoFade(const BOOL do_fade); - void setVisibleOffScreen(BOOL visible) { mVisibleOffScreen = visible; } - - // mMaxLines of -1 means unlimited lines. - void setMaxLines(S32 max_lines) { mMaxLines = max_lines; } - void setFadeDistance(F32 fade_distance, F32 fade_range) { mFadeDistance = fade_distance; mFadeRange = fade_range; } - void updateVisibility(); - LLVector2 updateScreenPos(LLVector2 &offset_target); - void updateSize(); -// void setMass(F32 mass) { mMass = llmax(0.1f, mass); } - void setTextAlignment(ETextAlignment alignment) { mTextAlignment = alignment; } - void setVertAlignment(EVertAlignment alignment) { mVertAlignment = alignment; } - /*virtual*/ void markDead(); - friend class LLHUDObject; - /*virtual*/ F32 getDistance() const { return mLastDistance; } - S32 getLOD() const { return mLOD; } - BOOL getVisible() const { return mVisible; } - BOOL getHidden() const { return mHidden; } - void setHidden( BOOL hide ) { mHidden = hide; } - void shift(const LLVector3& offset); - F32 getWorldHeight() const; - - BOOL lineSegmentIntersect(const LLVector4a& start, const LLVector4a& end, LLVector4a& intersection, BOOL debug_render = FALSE); - - static void shiftAll(const LLVector3& offset); - static void addPickable(std::set<LLViewerObject*> &pick_list); - static void reshape(); - static void setDisplayText(BOOL flag) { sDisplayText = flag ; } + // For bubble chat, set the part above the chat text + void setLabel(const std::string& label_utf8); + void addLabel(const std::string& label_utf8, F32 max_pixels = HUD_TEXT_MAX_WIDTH); + + // Sets the default font for lines with no font specified + void setFont(const LLFontGL* font); + void setColor(const LLColor4 &color); + void setAlpha(F32 alpha); + void setZCompare(const BOOL zcompare); + void setDoFade(const BOOL do_fade); + void setVisibleOffScreen(BOOL visible) { mVisibleOffScreen = visible; } + + // mMaxLines of -1 means unlimited lines. + void setMaxLines(S32 max_lines) { mMaxLines = max_lines; } + void setFadeDistance(F32 fade_distance, F32 fade_range) { mFadeDistance = fade_distance; mFadeRange = fade_range; } + void updateVisibility(); + LLVector2 updateScreenPos(LLVector2 &offset_target); + void updateSize(); +// void setMass(F32 mass) { mMass = llmax(0.1f, mass); } + void setTextAlignment(ETextAlignment alignment) { mTextAlignment = alignment; } + void setVertAlignment(EVertAlignment alignment) { mVertAlignment = alignment; } + /*virtual*/ void markDead(); + friend class LLHUDObject; + /*virtual*/ F32 getDistance() const { return mLastDistance; } + S32 getLOD() const { return mLOD; } + BOOL getVisible() const { return mVisible; } + BOOL getHidden() const { return mHidden; } + void setHidden( BOOL hide ) { mHidden = hide; } + void shift(const LLVector3& offset); + F32 getWorldHeight() const; + + BOOL lineSegmentIntersect(const LLVector4a& start, const LLVector4a& end, LLVector4a& intersection, BOOL debug_render = FALSE); + + static void shiftAll(const LLVector3& offset); + static void addPickable(std::set<LLViewerObject*> &pick_list); + static void reshape(); + static void setDisplayText(BOOL flag) { sDisplayText = flag ; } protected: - LLHUDNameTag(const U8 type); + LLHUDNameTag(const U8 type); - /*virtual*/ void render(); - void renderText(BOOL for_select); - static void updateAll(); - void setLOD(S32 lod); - S32 getMaxLines(); + /*virtual*/ void render(); + void renderText(BOOL for_select); + static void updateAll(); + void setLOD(S32 lod); + S32 getMaxLines(); private: - ~LLHUDNameTag(); - BOOL mDoFade; - F32 mFadeRange; - F32 mFadeDistance; - F32 mLastDistance; - BOOL mZCompare; - BOOL mVisibleOffScreen; - BOOL mOffscreen; - LLColor4 mColor; -// LLVector3 mScale; - F32 mWidth; - F32 mHeight; -// LLColor4U mPickColor; - const LLFontGL* mFontp; - const LLFontGL* mBoldFontp; - LLRectf mSoftScreenRect; - LLVector3 mPositionAgent; - LLVector2 mPositionOffset; - LLVector2 mTargetPositionOffset; - F32 mMass; - S32 mMaxLines; - S32 mOffsetY; - F32 mRadius; - std::vector<LLHUDTextSegment> mTextSegments; - std::vector<LLHUDTextSegment> mLabelSegments; -// LLFrameTimer mResizeTimer; - ETextAlignment mTextAlignment; - EVertAlignment mVertAlignment; - S32 mLOD; - BOOL mHidden; - LLPointer<LLUIImage> mRoundedRectImgp; - LLPointer<LLUIImage> mRoundedRectTopImgp; - - static BOOL sDisplayText ; - static std::set<LLPointer<LLHUDNameTag> > sTextObjects; - static std::vector<LLPointer<LLHUDNameTag> > sVisibleTextObjects; -// static std::vector<LLPointer<LLHUDNameTag> > sVisibleHUDTextObjects; - typedef std::set<LLPointer<LLHUDNameTag> >::iterator TextObjectIterator; - typedef std::vector<LLPointer<LLHUDNameTag> >::iterator VisibleTextObjectIterator; + ~LLHUDNameTag(); + BOOL mDoFade; + F32 mFadeRange; + F32 mFadeDistance; + F32 mLastDistance; + BOOL mZCompare; + BOOL mVisibleOffScreen; + BOOL mOffscreen; + LLColor4 mColor; +// LLVector3 mScale; + F32 mWidth; + F32 mHeight; +// LLColor4U mPickColor; + const LLFontGL* mFontp; + const LLFontGL* mBoldFontp; + LLRectf mSoftScreenRect; + LLVector3 mPositionAgent; + LLVector2 mPositionOffset; + LLVector2 mTargetPositionOffset; + F32 mMass; + S32 mMaxLines; + S32 mOffsetY; + F32 mRadius; + std::vector<LLHUDTextSegment> mTextSegments; + std::vector<LLHUDTextSegment> mLabelSegments; +// LLFrameTimer mResizeTimer; + ETextAlignment mTextAlignment; + EVertAlignment mVertAlignment; + S32 mLOD; + BOOL mHidden; + LLPointer<LLUIImage> mRoundedRectImgp; + LLPointer<LLUIImage> mRoundedRectTopImgp; + + static BOOL sDisplayText ; + static std::set<LLPointer<LLHUDNameTag> > sTextObjects; + static std::vector<LLPointer<LLHUDNameTag> > sVisibleTextObjects; +// static std::vector<LLPointer<LLHUDNameTag> > sVisibleHUDTextObjects; + typedef std::set<LLPointer<LLHUDNameTag> >::iterator TextObjectIterator; + typedef std::vector<LLPointer<LLHUDNameTag> >::iterator VisibleTextObjectIterator; }; #endif |