diff options
author | Nat Goodspeed <nat@lindenlab.com> | 2019-08-12 08:04:30 -0400 |
---|---|---|
committer | Nat Goodspeed <nat@lindenlab.com> | 2019-08-12 08:04:30 -0400 |
commit | 17902bc735ea33db11abd21095f7e0edafb7abe7 (patch) | |
tree | 0fd0b82f3bb4278f6565cc1256e361b7265aa3d7 /indra/llui/llui.h | |
parent | 8053bceaa0ccd6128536375c21cc3e9e19429efa (diff) | |
parent | 1be08814e252654db98ce8c39dc8b4cf89c2e1dc (diff) |
Automated merge with ssh://bitbucket.org/nat_linden/viewer-vs2017
Diffstat (limited to 'indra/llui/llui.h')
-rw-r--r-- | indra/llui/llui.h | 123 |
1 files changed, 63 insertions, 60 deletions
diff --git a/indra/llui/llui.h b/indra/llui/llui.h index d7151dbee9..9decaf92cb 100644 --- a/indra/llui/llui.h +++ b/indra/llui/llui.h @@ -109,8 +109,16 @@ class LLImageProviderInterface; typedef void (*LLUIAudioCallback)(const LLUUID& uuid); -class LLUI +class LLUI : public LLParamSingleton<LLUI> { +public: + typedef std::map<std::string, LLControlGroup*> settings_map_t; + +private: + LLPARAMSINGLETON(LLUI , const settings_map_t &settings, + LLImageProviderInterface* image_provider, + LLUIAudioCallback audio_callback, + LLUIAudioCallback deferred_audio_callback); LOG_CLASS(LLUI); public: // @@ -232,36 +240,24 @@ public: // // Methods // - typedef std::map<std::string, LLControlGroup*> settings_map_t; typedef boost::function<void(LLView*)> add_popup_t; typedef boost::function<void(LLView*)> remove_popup_t; typedef boost::function<void(void)> clear_popups_t; - static void initClass(const settings_map_t& settings, - LLImageProviderInterface* image_provider, - LLUIAudioCallback audio_callback = NULL, - LLUIAudioCallback deferred_audio_callback = NULL, - const LLVector2 *scale_factor = NULL, - const std::string& language = LLStringUtil::null); - static void cleanupClass(); - static void setPopupFuncs(const add_popup_t& add_popup, const remove_popup_t&, const clear_popups_t& ); - - static void pushMatrix() { LLRender2D::pushMatrix(); } - static void popMatrix() { LLRender2D::popMatrix(); } - static void loadIdentity() { LLRender2D::loadIdentity(); } - static void translate(F32 x, F32 y, F32 z = 0.0f) { LLRender2D::translate(x, y, z); } + void setPopupFuncs(const add_popup_t& add_popup, const remove_popup_t&, const clear_popups_t& ); - static LLRect sDirtyRect; - static BOOL sDirty; - static void dirtyRect(LLRect rect); + LLRect mDirtyRect; + BOOL mDirty; + void dirtyRect(LLRect rect); // Return the ISO639 language name ("en", "ko", etc.) for the viewer UI. // http://www.loc.gov/standards/iso639-2/php/code_list.php - static std::string getLanguage(); + std::string getUILanguage(); + static std::string getLanguage(); // static for lldateutil_test compatibility //helper functions (should probably move free standing rendering helper functions here) - static LLView* getRootView() { return sRootView; } - static void setRootView(LLView* view) { sRootView = view; } + LLView* getRootView() { return mRootView; } + void setRootView(LLView* view) { mRootView = view; } /** * Walk the LLView tree to resolve a path * Paths can be discovered using Develop > XUI > Show XUI Paths @@ -287,58 +283,65 @@ public: * tree, the first "bar" anywhere under it, and "baz" * as a direct child of that */ - static const LLView* resolvePath(const LLView* context, const std::string& path); - static LLView* resolvePath(LLView* context, const std::string& path); + const LLView* resolvePath(const LLView* context, const std::string& path); + LLView* resolvePath(LLView* context, const std::string& path); static std::string locateSkin(const std::string& filename); - static void setMousePositionScreen(S32 x, S32 y); - static void getMousePositionScreen(S32 *x, S32 *y); - static void setMousePositionLocal(const LLView* viewp, S32 x, S32 y); - static void getMousePositionLocal(const LLView* viewp, S32 *x, S32 *y); - static LLVector2& getScaleFactor() { return LLRender2D::sGLScaleFactor; } - static void setScaleFactor(const LLVector2& scale_factor) { LLRender2D::setScaleFactor(scale_factor); } - static void setLineWidth(F32 width) { LLRender2D::setLineWidth(width); } - static LLPointer<LLUIImage> getUIImageByID(const LLUUID& image_id, S32 priority = 0) - { return LLRender2D::getUIImageByID(image_id, priority); } - static LLPointer<LLUIImage> getUIImage(const std::string& name, S32 priority = 0) - { return LLRender2D::getUIImage(name, priority); } - static LLVector2 getWindowSize(); - static void screenPointToGL(S32 screen_x, S32 screen_y, S32 *gl_x, S32 *gl_y); - static void glPointToScreen(S32 gl_x, S32 gl_y, S32 *screen_x, S32 *screen_y); - static void screenRectToGL(const LLRect& screen, LLRect *gl); - static void glRectToScreen(const LLRect& gl, LLRect *screen); + void setMousePositionScreen(S32 x, S32 y); + void getMousePositionScreen(S32 *x, S32 *y); + void setMousePositionLocal(const LLView* viewp, S32 x, S32 y); + void getMousePositionLocal(const LLView* viewp, S32 *x, S32 *y); + LLVector2 getWindowSize(); + void screenPointToGL(S32 screen_x, S32 screen_y, S32 *gl_x, S32 *gl_y); + void glPointToScreen(S32 gl_x, S32 gl_y, S32 *screen_x, S32 *screen_y); + void screenRectToGL(const LLRect& screen, LLRect *gl); + void glRectToScreen(const LLRect& gl, LLRect *screen); // Returns the control group containing the control name, or the default group - static LLControlGroup& getControlControlGroup (const std::string& controlname); - static F32 getMouseIdleTime() { return sMouseIdleTimer.getElapsedTimeF32(); } - static void resetMouseIdleTimer() { sMouseIdleTimer.reset(); } - static LLWindow* getWindow() { return sWindow; } + LLControlGroup& getControlControlGroup (const std::string& controlname); + F32 getMouseIdleTime() { return mMouseIdleTimer.getElapsedTimeF32(); } + void resetMouseIdleTimer() { mMouseIdleTimer.reset(); } + LLWindow* getWindow() { return mWindow; } - static void addPopup(LLView*); - static void removePopup(LLView*); - static void clearPopups(); + void addPopup(LLView*); + void removePopup(LLView*); + void clearPopups(); - static void reportBadKeystroke(); + void reportBadKeystroke(); // Ensures view does not overlap mouse cursor, but is inside // the view's parent rectangle. Used for tooltips, inspectors. // Optionally override the view's default X/Y, which are relative to the // view's parent. - static void positionViewNearMouse(LLView* view, S32 spawn_x = S32_MAX, S32 spawn_y = S32_MAX); + void positionViewNearMouse(LLView* view, S32 spawn_x = S32_MAX, S32 spawn_y = S32_MAX); + + // LLRender2D wrappers + static void pushMatrix() { LLRender2D::getInstance()->pushMatrix(); } + static void popMatrix() { LLRender2D::getInstance()->popMatrix(); } + static void loadIdentity() { LLRender2D::getInstance()->loadIdentity(); } + static void translate(F32 x, F32 y, F32 z = 0.0f) { LLRender2D::getInstance()->translate(x, y, z); } + + static LLVector2& getScaleFactor() { return LLRender2D::getInstance()->mGLScaleFactor; } + static void setScaleFactor(const LLVector2& scale_factor) { LLRender2D::getInstance()->setScaleFactor(scale_factor); } + static void setLineWidth(F32 width) { LLRender2D::getInstance()->setLineWidth(width); } + static LLPointer<LLUIImage> getUIImageByID(const LLUUID& image_id, S32 priority = 0) + { return LLRender2D::getInstance()->getUIImageByID(image_id, priority); } + static LLPointer<LLUIImage> getUIImage(const std::string& name, S32 priority = 0) + { return LLRender2D::getInstance()->getUIImage(name, priority); } // // Data // - static settings_map_t sSettingGroups; - static LLUIAudioCallback sAudioCallback; - static LLUIAudioCallback sDeferredAudioCallback; - static LLWindow* sWindow; - static LLView* sRootView; - static LLHelp* sHelpImpl; + settings_map_t mSettingGroups; + LLUIAudioCallback mAudioCallback; + LLUIAudioCallback mDeferredAudioCallback; + LLWindow* mWindow; + LLView* mRootView; + LLHelp* mHelpImpl; private: - static std::vector<std::string> sXUIPaths; - static LLFrameTimer sMouseIdleTimer; - static add_popup_t sAddPopupFunc; - static remove_popup_t sRemovePopupFunc; - static clear_popups_t sClearPopupsFunc; + std::vector<std::string> mXUIPaths; + LLFrameTimer mMouseIdleTimer; + add_popup_t mAddPopupFunc; + remove_popup_t mRemovePopupFunc; + clear_popups_t mClearPopupsFunc; }; @@ -363,7 +366,7 @@ public: LLUICachedControl(const std::string& name, const T& default_value, const std::string& comment = "Declared In Code") - : LLCachedControl<T>(LLUI::getControlControlGroup(name), name, default_value, comment) + : LLCachedControl<T>(LLUI::getInstance()->getControlControlGroup(name), name, default_value, comment) {} }; |