diff options
author | Ansariel <ansariel.hiller@phoenixviewer.com> | 2024-05-22 19:04:52 +0200 |
---|---|---|
committer | Ansariel <ansariel.hiller@phoenixviewer.com> | 2024-05-22 19:04:52 +0200 |
commit | 1b67dd855c41f5a0cda7ec2a68d98071986ca703 (patch) | |
tree | ab243607f74f78200787bba5b9b88f07ef1b966f /indra/newview/llhudtext.h | |
parent | 6d6eabca44d08d5b97bfe3e941d2b9687c2246ea (diff) | |
parent | e1623bb276f83a43ce7a197e388720c05bdefe61 (diff) |
Merge remote-tracking branch 'origin/main' into DRTVWR-600-maint-A
# Conflicts:
# autobuild.xml
# indra/cmake/CMakeLists.txt
# indra/cmake/GoogleMock.cmake
# indra/llaudio/llaudioengine_fmodstudio.cpp
# indra/llaudio/llaudioengine_fmodstudio.h
# indra/llaudio/lllistener_fmodstudio.cpp
# indra/llaudio/lllistener_fmodstudio.h
# indra/llaudio/llstreamingaudio_fmodstudio.cpp
# indra/llaudio/llstreamingaudio_fmodstudio.h
# indra/llcharacter/llmultigesture.cpp
# indra/llcharacter/llmultigesture.h
# indra/llimage/llimage.cpp
# indra/llimage/llimagepng.cpp
# indra/llimage/llimageworker.cpp
# indra/llimage/tests/llimageworker_test.cpp
# indra/llmessage/tests/llmockhttpclient.h
# indra/llprimitive/llgltfmaterial.h
# indra/llrender/llfontfreetype.cpp
# indra/llui/llcombobox.cpp
# indra/llui/llfolderview.cpp
# indra/llui/llfolderviewmodel.h
# indra/llui/lllineeditor.cpp
# indra/llui/lllineeditor.h
# indra/llui/lltextbase.cpp
# indra/llui/lltextbase.h
# indra/llui/lltexteditor.cpp
# indra/llui/lltextvalidate.cpp
# indra/llui/lltextvalidate.h
# indra/llui/lluictrl.h
# indra/llui/llview.cpp
# indra/llwindow/llwindowmacosx.cpp
# indra/newview/app_settings/settings.xml
# indra/newview/llappearancemgr.cpp
# indra/newview/llappearancemgr.h
# indra/newview/llavatarpropertiesprocessor.cpp
# indra/newview/llavatarpropertiesprocessor.h
# indra/newview/llbreadcrumbview.cpp
# indra/newview/llbreadcrumbview.h
# indra/newview/llbreastmotion.cpp
# indra/newview/llbreastmotion.h
# indra/newview/llconversationmodel.h
# indra/newview/lldensityctrl.cpp
# indra/newview/lldensityctrl.h
# indra/newview/llface.inl
# indra/newview/llfloatereditsky.cpp
# indra/newview/llfloatereditwater.cpp
# indra/newview/llfloateremojipicker.h
# indra/newview/llfloaterimsessiontab.cpp
# indra/newview/llfloaterprofiletexture.cpp
# indra/newview/llfloaterprofiletexture.h
# indra/newview/llgesturemgr.cpp
# indra/newview/llgesturemgr.h
# indra/newview/llimpanel.cpp
# indra/newview/llimpanel.h
# indra/newview/llinventorybridge.cpp
# indra/newview/llinventorybridge.h
# indra/newview/llinventoryclipboard.cpp
# indra/newview/llinventoryclipboard.h
# indra/newview/llinventoryfunctions.cpp
# indra/newview/llinventoryfunctions.h
# indra/newview/llinventorygallery.cpp
# indra/newview/lllistbrowser.cpp
# indra/newview/lllistbrowser.h
# indra/newview/llpanelobjectinventory.cpp
# indra/newview/llpanelprofile.cpp
# indra/newview/llpanelprofile.h
# indra/newview/llpreviewgesture.cpp
# indra/newview/llsavedsettingsglue.cpp
# indra/newview/llsavedsettingsglue.h
# indra/newview/lltooldraganddrop.cpp
# indra/newview/llurllineeditorctrl.cpp
# indra/newview/llvectorperfoptions.cpp
# indra/newview/llvectorperfoptions.h
# indra/newview/llviewerparceloverlay.cpp
# indra/newview/llviewertexlayer.cpp
# indra/newview/llviewertexturelist.cpp
# indra/newview/macmain.h
# indra/test/test.cpp
Diffstat (limited to 'indra/newview/llhudtext.h')
-rw-r--r-- | indra/newview/llhudtext.h | 346 |
1 files changed, 173 insertions, 173 deletions
diff --git a/indra/newview/llhudtext.h b/indra/newview/llhudtext.h index 116d2e50fd..8556b131b5 100644 --- a/indra/newview/llhudtext.h +++ b/indra/newview/llhudtext.h @@ -1,173 +1,173 @@ -/** - * @file llhudtext.h - * @brief LLHUDText class definition - * - * $LicenseInfo:firstyear=2002&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$ - */ - -#ifndef LL_LLHUDTEXT_H -#define LL_LLHUDTEXT_H - -#include "llpointer.h" - -#include "llhudobject.h" -#include "v4color.h" -#include "v4coloru.h" -#include "v2math.h" -#include "llrect.h" -#include "llfontgl.h" -#include <set> -#include <vector> - -// Renders a 2D text billboard floating at the location specified. -class LLDrawable; -class LLHUDText; - -struct lltextobject_further_away -{ - bool operator()(const LLPointer<LLHUDText>& lhs, const LLPointer<LLHUDText>& rhs) const; -}; - -class LLHUDText : 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; - }; - -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; - -public: - // Set entire string, eliminating existing lines - void setString(const std::string& text_utf8); - - void clearString(); - - // 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, const LLFontGL* font = NULL); - - // 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; } - bool getVisible() { return mVisible; } - bool getHidden() const { return mHidden; } - void setHidden( bool hide ) { mHidden = hide; } - void setOnHUDAttachment(bool on_hud) { mOnHUDAttachment = on_hud; } - void shift(const LLVector3& offset); - - static void shiftAll(const LLVector3& offset); - static void renderAllHUD(); - static void reshape(); - static void setDisplayText(bool flag) { sDisplayText = flag ; } - -protected: - LLHUDText(const U8 type); - - /*virtual*/ void render(); - void renderText(); - static void updateAll(); - S32 getMaxLines(); - -private: - ~LLHUDText(); - bool mOnHUDAttachment; - 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; - ETextAlignment mTextAlignment; - EVertAlignment mVertAlignment; - bool mHidden; - - static bool sDisplayText ; - static std::set<LLPointer<LLHUDText> > sTextObjects; - static std::vector<LLPointer<LLHUDText> > sVisibleTextObjects; - static std::vector<LLPointer<LLHUDText> > sVisibleHUDTextObjects; - typedef std::set<LLPointer<LLHUDText> >::iterator TextObjectIterator; - typedef std::vector<LLPointer<LLHUDText> >::iterator VisibleTextObjectIterator; -}; - -#endif // LL_LLHUDTEXT_H +/**
+ * @file llhudtext.h
+ * @brief LLHUDText class definition
+ *
+ * $LicenseInfo:firstyear=2002&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$
+ */
+
+#ifndef LL_LLHUDTEXT_H
+#define LL_LLHUDTEXT_H
+
+#include "llpointer.h"
+
+#include "llhudobject.h"
+#include "v4color.h"
+#include "v4coloru.h"
+#include "v2math.h"
+#include "llrect.h"
+#include "llfontgl.h"
+#include <set>
+#include <vector>
+
+// Renders a 2D text billboard floating at the location specified.
+class LLDrawable;
+class LLHUDText;
+
+struct lltextobject_further_away
+{
+ bool operator()(const LLPointer<LLHUDText>& lhs, const LLPointer<LLHUDText>& rhs) const;
+};
+
+class LLHUDText : 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;
+ };
+
+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;
+
+public:
+ // Set entire string, eliminating existing lines
+ void setString(const std::string& text_utf8);
+
+ void clearString();
+
+ // 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, const LLFontGL* font = NULL);
+
+ // 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; }
+ bool getVisible() { return mVisible; }
+ bool getHidden() const { return mHidden; }
+ void setHidden( bool hide ) { mHidden = hide; }
+ void setOnHUDAttachment(bool on_hud) { mOnHUDAttachment = on_hud; }
+ void shift(const LLVector3& offset);
+
+ static void shiftAll(const LLVector3& offset);
+ static void renderAllHUD();
+ static void reshape();
+ static void setDisplayText(bool flag) { sDisplayText = flag ; }
+
+protected:
+ LLHUDText(const U8 type);
+
+ /*virtual*/ void render();
+ void renderText();
+ static void updateAll();
+ S32 getMaxLines();
+
+private:
+ ~LLHUDText();
+ bool mOnHUDAttachment;
+ 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;
+ ETextAlignment mTextAlignment;
+ EVertAlignment mVertAlignment;
+ bool mHidden;
+
+ static bool sDisplayText ;
+ static std::set<LLPointer<LLHUDText> > sTextObjects;
+ static std::vector<LLPointer<LLHUDText> > sVisibleTextObjects;
+ static std::vector<LLPointer<LLHUDText> > sVisibleHUDTextObjects;
+ typedef std::set<LLPointer<LLHUDText> >::iterator TextObjectIterator;
+ typedef std::vector<LLPointer<LLHUDText> >::iterator VisibleTextObjectIterator;
+};
+
+#endif // LL_LLHUDTEXT_H
|