diff --git a/indra/llcommon/llframetimer.h b/indra/llcommon/llframetimer.h index 81bd5da8a3e79e91bf69c61e6d3893a0dc5a9f7b..a5e640a3e2e6bada7952383179cf5d85f0b51909 100644 --- a/indra/llcommon/llframetimer.h +++ b/indra/llcommon/llframetimer.h @@ -41,6 +41,11 @@ class LL_COMMON_API LLFrameTimer public: LLFrameTimer() : mStartTime( sFrameTime ), mExpiry(0), mStarted(TRUE) {} + enum ConstInitType { + kConstInit, + }; + explicit constexpr LLFrameTimer(ConstInitType) : mStartTime(0), mExpiry(0), mStarted(TRUE) {} + // Return the number of seconds since the start of this // application instance. static F64SecondsImplicit getElapsedSeconds() diff --git a/indra/llui/llbutton.cpp b/indra/llui/llbutton.cpp index e97ac05af6005231b854689e2951b588fb758315..dda71b35ea8b2eaa273c66e69bced91bf0753ff5 100644 --- a/indra/llui/llbutton.cpp +++ b/indra/llui/llbutton.cpp @@ -641,7 +641,7 @@ void LLButton::draw() { S32 local_mouse_x ; S32 local_mouse_y; - LLUI::getInstance()->getMousePositionLocal(this, &local_mouse_x, &local_mouse_y); + LLUI::getMousePositionLocal(this, &local_mouse_x, &local_mouse_y); mouse_pressed_and_over = pointInView(local_mouse_x, local_mouse_y); } diff --git a/indra/llui/llchatentry.cpp b/indra/llui/llchatentry.cpp index c50657612621d16b94134f7c49e1315eb0b019ee..dac001afabcf757be529aa00b85cd4b0491f021e 100644 --- a/indra/llui/llchatentry.cpp +++ b/indra/llui/llchatentry.cpp @@ -201,7 +201,7 @@ BOOL LLChatEntry::handleSpecialKey(const KEY key, const MASK mask) } else { - LLUI::getInstance()->reportBadKeystroke(); + LLUI::reportBadKeystroke(); } handled = TRUE; } @@ -225,7 +225,7 @@ BOOL LLChatEntry::handleSpecialKey(const KEY key, const MASK mask) } else { - LLUI::getInstance()->reportBadKeystroke(); + LLUI::reportBadKeystroke(); } handled = TRUE; } diff --git a/indra/llui/llfolderview.cpp b/indra/llui/llfolderview.cpp index 6c139b89b435e80b719894d183dbcd9f6e9b0d29..d38a109b3df80b2660db8d693c09bc09678a8aa6 100644 --- a/indra/llui/llfolderview.cpp +++ b/indra/llui/llfolderview.cpp @@ -1842,7 +1842,7 @@ void LLFolderView::updateRenamerPosition() screenPointToLocal( x, y, &x, &y ); mRenamer->setOrigin( x, y ); - LLRect scroller_rect(0, 0, (S32)LLUI::getInstance()->getWindowSize().mV[VX], 0); + LLRect scroller_rect(0, 0, (S32)LLUI::getWindowSize().mV[VX], 0); if (mScrollContainer) { scroller_rect = mScrollContainer->getContentWindowRect(); diff --git a/indra/llui/lllineeditor.cpp b/indra/llui/lllineeditor.cpp index 06f4f24fe0d4eeb62393ac0bec0ada415e9121c4..e7b4f32d14f26e18c756b9ae1a09ffbc71fffa66 100644 --- a/indra/llui/lllineeditor.cpp +++ b/indra/llui/lllineeditor.cpp @@ -938,7 +938,7 @@ void LLLineEditor::removeChar() } else { - LLUI::getInstance()->reportBadKeystroke(); + LLUI::reportBadKeystroke(); } } @@ -965,7 +965,7 @@ void LLLineEditor::removeWord(bool prev) } else { - LLUI::getInstance()->reportBadKeystroke(); + LLUI::reportBadKeystroke(); } } @@ -1015,7 +1015,7 @@ void LLLineEditor::addChar(const llwchar uni_char) } else { - LLUI::getInstance()->reportBadKeystroke(); + LLUI::reportBadKeystroke(); } getWindow()->hideCursorUntilMouseMove(); @@ -1111,7 +1111,7 @@ BOOL LLLineEditor::handleSelectionKey(KEY key, MASK mask) } else { - LLUI::getInstance()->reportBadKeystroke(); + LLUI::reportBadKeystroke(); } break; @@ -1127,7 +1127,7 @@ BOOL LLLineEditor::handleSelectionKey(KEY key, MASK mask) } else { - LLUI::getInstance()->reportBadKeystroke(); + LLUI::reportBadKeystroke(); } break; @@ -1207,7 +1207,7 @@ void LLLineEditor::cut() if( need_to_rollback ) { rollback.doRollback( this ); - LLUI::getInstance()->reportBadKeystroke(); + LLUI::reportBadKeystroke(); } else { @@ -1311,7 +1311,7 @@ void LLLineEditor::pasteHelper(bool is_primary) } // Truncate the clean string at the limit of what will fit clean_string = clean_string.substr(0, wchars_that_fit); - LLUI::getInstance()->reportBadKeystroke(); + LLUI::reportBadKeystroke(); } if (mMaxLengthChars) @@ -1323,7 +1323,7 @@ void LLLineEditor::pasteHelper(bool is_primary) clean_string = clean_string.substr(0, available_chars); } - LLUI::getInstance()->reportBadKeystroke(); + LLUI::reportBadKeystroke(); } mText.insert(getCursor(), clean_string); @@ -1335,7 +1335,7 @@ void LLLineEditor::pasteHelper(bool is_primary) if( need_to_rollback ) { rollback.doRollback( this ); - LLUI::getInstance()->reportBadKeystroke(); + LLUI::reportBadKeystroke(); } else { @@ -1402,7 +1402,7 @@ BOOL LLLineEditor::handleSpecialKey(KEY key, MASK mask) } else { - LLUI::getInstance()->reportBadKeystroke(); + LLUI::reportBadKeystroke(); } } handled = TRUE; @@ -1459,7 +1459,7 @@ BOOL LLLineEditor::handleSpecialKey(KEY key, MASK mask) } else { - LLUI::getInstance()->reportBadKeystroke(); + LLUI::reportBadKeystroke(); } handled = TRUE; } @@ -1486,7 +1486,7 @@ BOOL LLLineEditor::handleSpecialKey(KEY key, MASK mask) } else { - LLUI::getInstance()->reportBadKeystroke(); + LLUI::reportBadKeystroke(); } handled = TRUE; } @@ -1503,7 +1503,7 @@ BOOL LLLineEditor::handleSpecialKey(KEY key, MASK mask) } else { - LLUI::getInstance()->reportBadKeystroke(); + LLUI::reportBadKeystroke(); } handled = TRUE; } @@ -1520,7 +1520,7 @@ BOOL LLLineEditor::handleSpecialKey(KEY key, MASK mask) } else { - LLUI::getInstance()->reportBadKeystroke(); + LLUI::reportBadKeystroke(); } handled = TRUE; } @@ -1601,7 +1601,7 @@ BOOL LLLineEditor::handleKeyHere(KEY key, MASK mask ) { rollback.doRollback(this); - LLUI::getInstance()->reportBadKeystroke(); + LLUI::reportBadKeystroke(); } // Notify owner if requested @@ -1657,7 +1657,7 @@ BOOL LLLineEditor::handleUnicodeCharHere(llwchar uni_char) { rollback.doRollback( this ); - LLUI::getInstance()->reportBadKeystroke(); + LLUI::reportBadKeystroke(); } // Notify owner if requested @@ -1708,7 +1708,7 @@ void LLLineEditor::doDelete() if( need_to_rollback ) { rollback.doRollback( this ); - LLUI::getInstance()->reportBadKeystroke(); + LLUI::reportBadKeystroke(); } else { @@ -2507,7 +2507,7 @@ BOOL LLLineEditor::getPreeditLocation(S32 query_offset, LLCoordGL *coord, LLRect { LLRect control_rect_screen; localRectToScreen(getRect(), &control_rect_screen); - LLUI::getInstance()->screenRectToGL(control_rect_screen, control); + LLUI::screenRectToGL(control_rect_screen, control); } S32 preedit_left_column, preedit_right_column; @@ -2537,7 +2537,7 @@ BOOL LLLineEditor::getPreeditLocation(S32 query_offset, LLCoordGL *coord, LLRect S32 query_local = findPixelNearestPos(query - getCursor()); S32 query_screen_x, query_screen_y; localPointToScreen(query_local, getRect().getHeight() / 2, &query_screen_x, &query_screen_y); - LLUI::getInstance()->screenPointToGL(query_screen_x, query_screen_y, &coord->mX, &coord->mY); + LLUI::screenPointToGL(query_screen_x, query_screen_y, &coord->mX, &coord->mY); } if (bounds) @@ -2553,7 +2553,7 @@ BOOL LLLineEditor::getPreeditLocation(S32 query_offset, LLCoordGL *coord, LLRect LLRect preedit_rect_local(preedit_left_local, getRect().getHeight(), preedit_right_local, 0); LLRect preedit_rect_screen; localRectToScreen(preedit_rect_local, &preedit_rect_screen); - LLUI::getInstance()->screenRectToGL(preedit_rect_screen, bounds); + LLUI::screenRectToGL(preedit_rect_screen, bounds); } return TRUE; diff --git a/indra/llui/llmenugl.cpp b/indra/llui/llmenugl.cpp index 629bd876d7640c022fb49de8dbd4540a5adfdf5b..7ed4ddc52e37ab87306bae61b9c83df4d55fa95e 100644 --- a/indra/llui/llmenugl.cpp +++ b/indra/llui/llmenugl.cpp @@ -3289,7 +3289,7 @@ void LLMenuGL::showPopup(LLView* spawning_view, LLMenuGL* menu, S32 x, S32 y) menu->needsArrange(); menu->arrangeAndClear(); - LLUI::getInstance()->getMousePositionLocal(menu->getParent(), &mouse_x, &mouse_y); + LLUI::getMousePositionLocal(menu->getParent(), &mouse_x, &mouse_y); LLMenuHolderGL::sContextMenuSpawnPos.set(mouse_x,mouse_y); const LLRect menu_region_rect = LLMenuGL::sMenuContainer->getRect(); diff --git a/indra/llui/llmodaldialog.cpp b/indra/llui/llmodaldialog.cpp index 5cfa8ea9738cbe7ac36678a57fd8edbca6946685..208b27fd9b33c5e540229d1350e958cc9e0ec5e3 100644 --- a/indra/llui/llmodaldialog.cpp +++ b/indra/llui/llmodaldialog.cpp @@ -165,7 +165,7 @@ BOOL LLModalDialog::handleMouseDown(S32 x, S32 y, MASK mask) if (popup_menu != NULL) { S32 mx, my; - LLUI::getInstance()->getMousePositionScreen(&mx, &my); + LLUI::getMousePositionScreen(&mx, &my); LLRect menu_screen_rc = popup_menu->calcScreenRect(); if(!menu_screen_rc.pointInRect(mx, my)) { @@ -202,7 +202,7 @@ BOOL LLModalDialog::handleHover(S32 x, S32 y, MASK mask) if (popup_menu != NULL) { S32 mx, my; - LLUI::getInstance()->getMousePositionScreen(&mx, &my); + LLUI::getMousePositionScreen(&mx, &my); LLRect menu_screen_rc = popup_menu->calcScreenRect(); if(menu_screen_rc.pointInRect(mx, my)) { @@ -286,7 +286,7 @@ void LLModalDialog::draw() void LLModalDialog::centerOnScreen() { - LLVector2 window_size = LLUI::getInstance()->getWindowSize(); + LLVector2 window_size = LLUI::getWindowSize(); centerWithin(LLRect(0, 0, ll_round(window_size.mV[VX]), ll_round(window_size.mV[VY]))); } diff --git a/indra/llui/llscrollbar.cpp b/indra/llui/llscrollbar.cpp index fde6de49219bc6acc031d1293bf462ac054651fd..f728d4fa1c49734a17c238700401a84ea0d4a28a 100644 --- a/indra/llui/llscrollbar.cpp +++ b/indra/llui/llscrollbar.cpp @@ -498,7 +498,7 @@ void LLScrollbar::draw() S32 local_mouse_x; S32 local_mouse_y; - LLUI::getInstance()->getMousePositionLocal(this, &local_mouse_x, &local_mouse_y); + LLUI::getMousePositionLocal(this, &local_mouse_x, &local_mouse_y); BOOL other_captor = gFocusMgr.getMouseCapture() && gFocusMgr.getMouseCapture() != this; BOOL hovered = getEnabled() && !other_captor && (hasMouseCapture() || mThumbRect.pointInRect(local_mouse_x, local_mouse_y)); if (hovered) diff --git a/indra/llui/lltextbase.cpp b/indra/llui/lltextbase.cpp index 57a2aa78a6dae11636791b73934401c1e4425ade..83dbcdff12253f893c2e7fc7a44a3798fc2b063e 100644 --- a/indra/llui/lltextbase.cpp +++ b/indra/llui/lltextbase.cpp @@ -3340,7 +3340,7 @@ BOOL LLNormalTextSegment::handleHover(S32 x, S32 y, MASK mask) // Only process the click if it's actually in this segment, not to the right of the end-of-line. if(mEditor.getSegmentAtLocalPos(x, y, false) == this) { - LLUI::getInstance()->getWindow()->setCursor(UI_CURSOR_HAND); + LLUI::getWindow()->setCursor(UI_CURSOR_HAND); return TRUE; } } diff --git a/indra/llui/lltextbox.cpp b/indra/llui/lltextbox.cpp index 3ceeb23dd3a0623648d9df2362ecce7a34c534e8..f8a5a98cfa63c4821ac733e89965d72876b3718c 100644 --- a/indra/llui/lltextbox.cpp +++ b/indra/llui/lltextbox.cpp @@ -107,7 +107,7 @@ BOOL LLTextBox::handleHover(S32 x, S32 y, MASK mask) if (!handled && mClickedCallback && mShowCursorHand) { // Clickable text boxes change the cursor to a hand - LLUI::getInstance()->getWindow()->setCursor(UI_CURSOR_HAND); + LLUI::getWindow()->setCursor(UI_CURSOR_HAND); return TRUE; } return handled; diff --git a/indra/llui/lltexteditor.cpp b/indra/llui/lltexteditor.cpp index a09192dbb6bc643886822714aa466a5f1fd51403..f36fc1a5778510f6da3ab18cb501011815d6af54 100644 --- a/indra/llui/lltexteditor.cpp +++ b/indra/llui/lltexteditor.cpp @@ -1049,7 +1049,7 @@ void LLTextEditor::removeCharOrTab() } else { - LLUI::getInstance()->reportBadKeystroke(); + LLUI::reportBadKeystroke(); } } @@ -1072,7 +1072,7 @@ void LLTextEditor::removeChar() } else { - LLUI::getInstance()->reportBadKeystroke(); + LLUI::reportBadKeystroke(); } } @@ -1099,7 +1099,7 @@ void LLTextEditor::removeWord(bool prev) } else { - LLUI::getInstance()->reportBadKeystroke(); + LLUI::reportBadKeystroke(); } } @@ -1346,7 +1346,7 @@ BOOL LLTextEditor::handleNavigationKey(const KEY key, const MASK mask) } else { - LLUI::getInstance()->reportBadKeystroke(); + LLUI::reportBadKeystroke(); } } break; @@ -1364,7 +1364,7 @@ BOOL LLTextEditor::handleNavigationKey(const KEY key, const MASK mask) } else { - LLUI::getInstance()->reportBadKeystroke(); + LLUI::reportBadKeystroke(); } } break; @@ -1699,7 +1699,7 @@ BOOL LLTextEditor::handleSpecialKey(const KEY key, const MASK mask) } else { - LLUI::getInstance()->reportBadKeystroke(); + LLUI::reportBadKeystroke(); } break; @@ -2789,7 +2789,7 @@ BOOL LLTextEditor::getPreeditLocation(S32 query_offset, LLCoordGL *coord, LLRect { LLRect control_rect_screen; localRectToScreen(mVisibleTextRect, &control_rect_screen); - LLUI::getInstance()->screenRectToGL(control_rect_screen, control); + LLUI::screenRectToGL(control_rect_screen, control); } S32 preedit_left_position, preedit_right_position; @@ -2843,7 +2843,7 @@ BOOL LLTextEditor::getPreeditLocation(S32 query_offset, LLCoordGL *coord, LLRect const S32 query_y = mVisibleTextRect.mTop - (current_line - first_visible_line) * line_height - line_height / 2; S32 query_screen_x, query_screen_y; localPointToScreen(query_x, query_y, &query_screen_x, &query_screen_y); - LLUI::getInstance()->screenPointToGL(query_screen_x, query_screen_y, &coord->mX, &coord->mY); + LLUI::screenPointToGL(query_screen_x, query_screen_y, &coord->mX, &coord->mY); } if (bounds) @@ -2870,7 +2870,7 @@ BOOL LLTextEditor::getPreeditLocation(S32 query_offset, LLCoordGL *coord, LLRect const LLRect preedit_rect_local(preedit_left, preedit_top, preedit_right, preedit_bottom); LLRect preedit_rect_screen; localRectToScreen(preedit_rect_local, &preedit_rect_screen); - LLUI::getInstance()->screenRectToGL(preedit_rect_screen, bounds); + LLUI::screenRectToGL(preedit_rect_screen, bounds); } return TRUE; diff --git a/indra/llui/lltoggleablemenu.cpp b/indra/llui/lltoggleablemenu.cpp index 3e56e0a589c7b7a27ae419e01ea820d2ff1080e3..ccb92ffbb2a6a944660b7cb8b52f0b949df25bba 100644 --- a/indra/llui/lltoggleablemenu.cpp +++ b/indra/llui/lltoggleablemenu.cpp @@ -55,7 +55,7 @@ boost::signals2::connection LLToggleableMenu::setVisibilityChangeCallback(const void LLToggleableMenu::onVisibilityChange (BOOL curVisibilityIn) { S32 x,y; - LLUI::getInstance()->getMousePositionLocal(LLUI::getInstance()->getRootView(), &x, &y); + LLUI::getMousePositionLocal(LLUI::getRootView(), &x, &y); // STORM-1879: also check MouseCapture to see if the button was really // clicked (otherwise the VisibilityChange was triggered via keyboard shortcut) diff --git a/indra/llui/lltooltip.cpp b/indra/llui/lltooltip.cpp index db1247c7a2b2acda59584002d3829bc096a3d8a3..cdccf0691b3113bbfcb9c1b5d7b86676eef15e1c 100644 --- a/indra/llui/lltooltip.cpp +++ b/indra/llui/lltooltip.cpp @@ -441,12 +441,12 @@ void LLToolTipMgr::createToolTip(const LLToolTip::Params& params) { LLCoordGL pos = params.pos; // try to spawn at requested position - LLUI::getInstance()->positionViewNearMouse(mToolTip, pos.mX, pos.mY); + LLUI::positionViewNearMouse(mToolTip, pos.mX, pos.mY); } else { // just spawn at mouse location - LLUI::getInstance()->positionViewNearMouse(mToolTip); + LLUI::positionViewNearMouse(mToolTip); } //...update "sticky" rect and tooltip position @@ -458,7 +458,7 @@ void LLToolTipMgr::createToolTip(const LLToolTip::Params& params) { S32 mouse_x; S32 mouse_y; - LLUI::getInstance()->getMousePositionLocal(gToolTipView->getParent(), &mouse_x, &mouse_y); + LLUI::getMousePositionLocal(gToolTipView->getParent(), &mouse_x, &mouse_y); // allow mouse a little bit of slop before changing tooltips mMouseNearRect.setCenterAndSize(mouse_x, mouse_y, 3, 3); @@ -496,7 +496,7 @@ void LLToolTipMgr::show(const LLToolTip::Params& params) // are we ready to show the tooltip? if (!mToolTipsBlocked // we haven't hit a key, moved the mouse, etc. - && LLUI::getInstance()->getMouseIdleTime() > params_with_defaults.delay_time) // the mouse has been still long enough + && LLUI::getMouseIdleTime() > params_with_defaults.delay_time) // the mouse has been still long enough { bool tooltip_changed = mLastToolTipParams.message() != params_with_defaults.message() || mLastToolTipParams.pos() != params_with_defaults.pos() @@ -568,7 +568,7 @@ void LLToolTipMgr::updateToolTipVisibility() } // hide tooltips when mouse cursor is hidden - if (LLUI::getInstance()->getWindow()->isCursorHidden()) + if (LLUI::getWindow()->isCursorHidden()) { blockToolTips(); return; @@ -579,7 +579,7 @@ void LLToolTipMgr::updateToolTipVisibility() if (toolTipVisible()) { S32 mouse_x, mouse_y; - LLUI::getInstance()->getMousePositionLocal(gToolTipView, &mouse_x, &mouse_y); + LLUI::getMousePositionLocal(gToolTipView, &mouse_x, &mouse_y); // mouse far away from tooltip tooltip_timeout = mLastToolTipParams.visible_time_far; diff --git a/indra/llui/llui.cpp b/indra/llui/llui.cpp index 019c5cbcd2ab60db9151a8b25d85b3dc933d25c7..b6d269101503f5473790302198fba75d87912545 100644 --- a/indra/llui/llui.cpp +++ b/indra/llui/llui.cpp @@ -85,6 +85,10 @@ static LLDefaultChildRegistry::Register<LLSearchEditor> register_search_editor(" static LLDefaultChildRegistry::Register<LLLoadingIndicator> register_loading_indicator("loading_indicator"); static LLDefaultChildRegistry::Register<LLToolBar> register_toolbar("toolbar"); +LLWindow* LLUI::sWindow = nullptr; +LLView* LLUI::sRootView = nullptr; +LLFrameTimer LLUI::sMouseIdleTimer(LLFrameTimer::kConstInit); + // // Functions // @@ -156,10 +160,10 @@ LLUI::LLUI(const settings_map_t& settings, : mSettingGroups(settings), mAudioCallback(audio_callback), mDeferredAudioCallback(deferred_audio_callback), -mWindow(NULL), // set later in startup -mRootView(NULL), mHelpImpl(NULL) { + resetMouseIdleTimer(); + LLRender2D::initParamSingleton(image_provider); if ((get_ptr_in_map(mSettingGroups, std::string("config")) == NULL) || @@ -202,6 +206,12 @@ mHelpImpl(NULL) LLCommandManager::load(); } +LLUI::~LLUI() +{ + sWindow = nullptr; + sRootView = nullptr; +} + void LLUI::setPopupFuncs(const add_popup_t& add_popup, const remove_popup_t& remove_popup, const clear_popups_t& clear_popups) { mAddPopupFunc = add_popup; @@ -209,6 +219,7 @@ void LLUI::setPopupFuncs(const add_popup_t& add_popup, const remove_popup_t& rem mClearPopupsFunc = clear_popups; } +// static void LLUI::setMousePositionScreen(S32 x, S32 y) { #if defined(LL_DARWIN) @@ -219,9 +230,10 @@ void LLUI::setMousePositionScreen(S32 x, S32 y) S32 screen_y = ll_round((F32)y * getScaleFactor().mV[VY]); #endif - LLView::getWindow()->setCursorPosition(LLCoordGL(screen_x, screen_y).convert()); + getWindow()->setCursorPosition(LLCoordGL(screen_x, screen_y).convert()); } +// static void LLUI::getMousePositionScreen(S32 *x, S32 *y) { LLCoordWindow cursor_pos_window; @@ -231,6 +243,7 @@ void LLUI::getMousePositionScreen(S32 *x, S32 *y) *y = ll_round((F32)cursor_pos_gl.mY / getScaleFactor().mV[VY]); } +// static void LLUI::setMousePositionLocal(const LLView* viewp, S32 x, S32 y) { S32 screen_x, screen_y; @@ -239,6 +252,7 @@ void LLUI::setMousePositionLocal(const LLView* viewp, S32 x, S32 y) setMousePositionScreen(screen_x, screen_y); } +// static void LLUI::getMousePositionLocal(const LLView* viewp, S32 *x, S32 *y) { S32 screen_x, screen_y; @@ -340,32 +354,37 @@ std::string LLUI::locateSkin(const std::string& filename) return ""; } +// static LLVector2 LLUI::getWindowSize() { LLCoordWindow window_rect; - mWindow->getSize(&window_rect); + getWindow()->getSize(&window_rect); return LLVector2(window_rect.mX / getScaleFactor().mV[VX], window_rect.mY / getScaleFactor().mV[VY]); } +// static void LLUI::screenPointToGL(S32 screen_x, S32 screen_y, S32 *gl_x, S32 *gl_y) { *gl_x = ll_round((F32)screen_x * getScaleFactor().mV[VX]); *gl_y = ll_round((F32)screen_y * getScaleFactor().mV[VY]); } +// static void LLUI::glPointToScreen(S32 gl_x, S32 gl_y, S32 *screen_x, S32 *screen_y) { *screen_x = ll_round((F32)gl_x / getScaleFactor().mV[VX]); *screen_y = ll_round((F32)gl_y / getScaleFactor().mV[VY]); } +// static void LLUI::screenRectToGL(const LLRect& screen, LLRect *gl) { screenPointToGL(screen.mLeft, screen.mTop, &gl->mLeft, &gl->mTop); screenPointToGL(screen.mRight, screen.mBottom, &gl->mRight, &gl->mBottom); } +// static void LLUI::glRectToScreen(const LLRect& gl, LLRect *screen) { glPointToScreen(gl.mLeft, gl.mTop, &screen->mLeft, &screen->mTop); @@ -373,7 +392,7 @@ void LLUI::glRectToScreen(const LLRect& gl, LLRect *screen) } -LLControlGroup& LLUI::getControlControlGroup (const std::string& controlname) +LLControlGroup& LLUI::getControlControlGroup(std::string_view controlname) { for (settings_map_t::iterator itor = mSettingGroups.begin(); itor != mSettingGroups.end(); ++itor) @@ -413,12 +432,14 @@ void LLUI::clearPopups() } } +// static void LLUI::reportBadKeystroke() { make_ui_sound("UISndBadKeystroke"); } // spawn_x and spawn_y are top left corner of view in screen GL coordinates +// static void LLUI::positionViewNearMouse(LLView* view, S32 spawn_x, S32 spawn_y) { const S32 CURSOR_HEIGHT = 16; // Approximate "normal" cursor size @@ -456,6 +477,7 @@ void LLUI::positionViewNearMouse(LLView* view, S32 spawn_x, S32 spawn_y) view->translateIntoRectWithExclusion( virtual_window_rect, mouse_rect ); } +// static LLView* LLUI::resolvePath(LLView* context, const std::string& path) { // Nothing about resolvePath() should require non-const LLView*. If caller @@ -463,6 +485,7 @@ LLView* LLUI::resolvePath(LLView* context, const std::string& path) return const_cast<LLView*>(resolvePath(const_cast<const LLView*>(context), path)); } +// static const LLView* LLUI::resolvePath(const LLView* context, const std::string& path) { // Create an iterator over slash-separated parts of 'path'. Dereferencing diff --git a/indra/llui/llui.h b/indra/llui/llui.h index a63756ab5d14d5530b837b69d2f43dc3d175e4b5..3ea715b5f803d0f6d37f884200b8a7db1a72b130 100644 --- a/indra/llui/llui.h +++ b/indra/llui/llui.h @@ -118,6 +118,8 @@ class LLUI final : public LLParamSingleton<LLUI> LLImageProviderInterface* image_provider, LLUIAudioCallback audio_callback, LLUIAudioCallback deferred_audio_callback); + ~LLUI(); + LOG_CLASS(LLUI); public: // @@ -251,8 +253,8 @@ class LLUI final : public LLParamSingleton<LLUI> static std::string getLanguage(); // static for lldateutil_test compatibility //helper functions (should probably move free standing rendering helper functions here) - LLView* getRootView() { return mRootView; } - void setRootView(LLView* view) { mRootView = view; } + static LLView* getRootView() { return sRootView; } + static void setRootView(LLView* view) { sRootView = view; } /** * Walk the LLView tree to resolve a path * Paths can be discovered using Develop > XUI > Show XUI Paths @@ -278,35 +280,35 @@ class LLUI final : public LLParamSingleton<LLUI> * tree, the first "bar" anywhere under it, and "baz" * as a direct child of that */ - const LLView* resolvePath(const LLView* context, const std::string& path); - LLView* resolvePath(LLView* context, const std::string& path); + static const LLView* resolvePath(const LLView* context, const std::string& path); + static LLView* resolvePath(LLView* context, const std::string& path); static std::string locateSkin(const std::string& filename); - 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); + 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 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); // Returns the control group containing the control name, or the default group - LLControlGroup& getControlControlGroup (const std::string& controlname); - F32 getMouseIdleTime() { return mMouseIdleTimer.getElapsedTimeF32(); } - void resetMouseIdleTimer() { mMouseIdleTimer.reset(); } - LLWindow* getWindow() { return mWindow; } + LLControlGroup& getControlControlGroup (std::string_view controlname); + static F32 getMouseIdleTime() { return sMouseIdleTimer.getElapsedTimeF32(); } + static void resetMouseIdleTimer() { sMouseIdleTimer.reset(); } + static LLWindow* getWindow() { return sWindow; } void addPopup(LLView*); void removePopup(LLView*); void clearPopups(); - void reportBadKeystroke(); + static 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. - void positionViewNearMouse(LLView* view, S32 spawn_x = S32_MAX, S32 spawn_y = S32_MAX); + static void positionViewNearMouse(LLView* view, S32 spawn_x = S32_MAX, S32 spawn_y = S32_MAX); // LLRender2D wrappers static void pushMatrix() { LLRender2D::pushMatrix(); } @@ -328,12 +330,12 @@ class LLUI final : public LLParamSingleton<LLUI> settings_map_t mSettingGroups; LLUIAudioCallback mAudioCallback; LLUIAudioCallback mDeferredAudioCallback; - LLWindow* mWindow; - LLView* mRootView; + static LLWindow* sWindow; + static LLView* sRootView; LLHelp* mHelpImpl; private: std::vector<std::string> mXUIPaths; - LLFrameTimer mMouseIdleTimer; + static LLFrameTimer sMouseIdleTimer; add_popup_t mAddPopupFunc; remove_popup_t mRemovePopupFunc; clear_popups_t mClearPopupsFunc; diff --git a/indra/llui/llview.cpp b/indra/llui/llview.cpp index 2574f6dcbc1b9a2532b28c6087b019a11ec73398..fec08f7602053f82b939e51b8defaa1a29ec9e54 100644 --- a/indra/llui/llview.cpp +++ b/indra/llui/llview.cpp @@ -844,7 +844,7 @@ LLView* LLView::childrenHandleHover(S32 x, S32 y, MASK mask) } // This call differentiates this method from childrenHandleMouseEvent(). - LLUI::getInstance()->mWindow->setCursor(viewp->getHoverCursor()); + LLUI::getWindow()->setCursor(viewp->getHoverCursor()); if (viewp->handleHover(local_x, local_y, mask) || viewp->blockMouseEvent(local_x, local_y)) @@ -1190,8 +1190,7 @@ void LLView::drawChildren() { if (!mChildList.empty()) { - auto& uiInst = LLUI::instance(); - LLView* rootp = uiInst.getRootView(); + LLView* rootp = LLUI::getRootView(); ++sDepth; for (LLView* viewp : boost::adaptors::reverse(mChildList)) diff --git a/indra/llui/llview.h b/indra/llui/llview.h index 499df896a64bbcf4eb7afdc3eb0e86af5956c813..b9d0b8b63d18131b2a1a06083f28a9e9e33a4f55 100644 --- a/indra/llui/llview.h +++ b/indra/llui/llview.h @@ -500,7 +500,7 @@ class LLView // return query for iterating over focus roots in tab order static const LLViewQuery & getFocusRootsQuery(); - static LLWindow* getWindow(void) { return LLUI::getInstance()->mWindow; } + static LLWindow* getWindow(void) { return LLUI::getWindow(); } // Set up params after XML load before calling new(), // usually to adjust layout. diff --git a/indra/llui/llviewereventrecorder.cpp b/indra/llui/llviewereventrecorder.cpp index bcac360ea34c5af2f36017de4f6947ee39032598..b0f65daf7a505ff828e23a337f44b1e2bad801ca 100644 --- a/indra/llui/llviewereventrecorder.cpp +++ b/indra/llui/llviewereventrecorder.cpp @@ -100,7 +100,7 @@ void LLViewerEventRecorder::setMouseGlobalCoords(S32 x, S32 y) { void LLViewerEventRecorder::updateMouseEventInfo(S32 local_x, S32 local_y, S32 global_x, S32 global_y, std::string mName) { if (!sLogEvents) return; - LLView * target_view = LLUI::getInstance()->resolvePath(LLUI::getInstance()->getRootView(), xui); + LLView * target_view = LLUI::resolvePath(LLUI::getRootView(), xui); if (! target_view) { LL_DEBUGS() << "LLViewerEventRecorder::updateMouseEventInfo - xui path on file at moment is NOT valid - so DO NOT record these local coords" << LL_ENDL; return; diff --git a/indra/llui/llviewinject.h b/indra/llui/llviewinject.h index 7f18ec6fbe8fce6fbc9ecb2d92992f59bf3625fe..0de3d155c41ba819b491ac4d93e1ed894e587c04 100644 --- a/indra/llui/llviewinject.h +++ b/indra/llui/llviewinject.h @@ -32,7 +32,7 @@ namespace llview public: /** * Construct TargetEvent with the desired target LLView*. (See - * LLUI::getInstance()->resolvePath() to obtain an LLView* given a string pathname.) + * LLUI::resolvePath() to obtain an LLView* given a string pathname.) * This sets up for operator(). */ TargetEvent(LLView* view); diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp index 2cb9d9bc459f49c01c9c9d9ba5012510f4c55a45..fb4df454a78ee4b751916a355b78acd8fda5ae7f 100644 --- a/indra/newview/llappviewer.cpp +++ b/indra/newview/llappviewer.cpp @@ -3078,7 +3078,7 @@ bool LLAppViewer::initWindow() gViewerWindow->getWindow()->maximize(); } - LLUI::getInstance()->mWindow = gViewerWindow->getWindow(); + LLUI::sWindow = gViewerWindow->getWindow(); // Show watch cursor gViewerWindow->setCursor(UI_CURSOR_WAIT); diff --git a/indra/newview/llexpandabletextbox.cpp b/indra/newview/llexpandabletextbox.cpp index 3395777aab42424db453fa9314140951e6814f46..d657f04457ab937c3070a1a41e703099d847af82 100644 --- a/indra/newview/llexpandabletextbox.cpp +++ b/indra/newview/llexpandabletextbox.cpp @@ -97,7 +97,7 @@ class LLExpanderSegment : public LLTextSegment /*virtual*/ BOOL handleMouseUp(S32 x, S32 y, MASK mask) { mEditor.onCommit(); return TRUE; } /*virtual*/ BOOL handleHover(S32 x, S32 y, MASK mask) { - LLUI::getInstance()->getWindow()->setCursor(UI_CURSOR_HAND); + LLUI::getWindow()->setCursor(UI_CURSOR_HAND); return TRUE; } private: diff --git a/indra/newview/llfloaterbvhpreview.cpp b/indra/newview/llfloaterbvhpreview.cpp index 131d9b077bd1d7cf4531e468284a979a2a2fb421..d2e2e03c84ef61cd1e3f1f796dbb08d7cf5529b0 100644 --- a/indra/newview/llfloaterbvhpreview.cpp +++ b/indra/newview/llfloaterbvhpreview.cpp @@ -528,7 +528,7 @@ BOOL LLFloaterBvhPreview::handleHover(S32 x, S32 y, MASK mask) mAnimPreview->requestUpdate(); - LLUI::getInstance()->setMousePositionLocal(this, mLastMouseX, mLastMouseY); + LLUI::setMousePositionLocal(this, mLastMouseX, mLastMouseY); } if (!mPreviewRect.pointInRect(x, y) || !mAnimPreview) diff --git a/indra/newview/llfloaterimagepreview.cpp b/indra/newview/llfloaterimagepreview.cpp index 028c922a4da8c9ab586666bcf24fa2d14d8bf927..a1d24be1ed737933b2f9dd0d8a6b7e1a5046021a 100644 --- a/indra/newview/llfloaterimagepreview.cpp +++ b/indra/newview/llfloaterimagepreview.cpp @@ -510,7 +510,7 @@ BOOL LLFloaterImagePreview::handleHover(S32 x, S32 y, MASK mask) mSculptedPreview->refresh(); } - LLUI::getInstance()->setMousePositionLocal(this, mLastMouseX, mLastMouseY); + LLUI::setMousePositionLocal(this, mLastMouseX, mLastMouseY); } if (!mPreviewRect.pointInRect(x, y) || !mAvatarPreview || !mSculptedPreview) diff --git a/indra/newview/llfloatermodelpreview.cpp b/indra/newview/llfloatermodelpreview.cpp index b9c03f66a3ee253ee5840de2f6b66e5b22bf6044..318197e61d7f8ca476ada29196a71332f7314511 100644 --- a/indra/newview/llfloatermodelpreview.cpp +++ b/indra/newview/llfloatermodelpreview.cpp @@ -869,7 +869,7 @@ BOOL LLFloaterModelPreview::handleHover (S32 x, S32 y, MASK mask) mModelPreview->refresh(); - LLUI::getInstance()->setMousePositionLocal(this, mLastMouseX, mLastMouseY); + LLUI::setMousePositionLocal(this, mLastMouseX, mLastMouseY); } if (!mPreviewRect.pointInRect(x, y) || !mModelPreview) diff --git a/indra/newview/llflyoutcombobtn.cpp b/indra/newview/llflyoutcombobtn.cpp index e4f1d9fcaa64922991d604df133c221a8d48faf2..0611395896d3b842f05117660f7cf8c6bc95a106 100644 --- a/indra/newview/llflyoutcombobtn.cpp +++ b/indra/newview/llflyoutcombobtn.cpp @@ -121,7 +121,7 @@ void LLFlyoutComboBtnCtrl::setMenuItemLabel(const std::string &item, const std:: void LLFlyoutComboBtnCtrl::onFlyoutButton(LLUICtrl *ctrl, const LLSD &data) { S32 x, y; - LLUI::getInstance()->getMousePositionLocal(mParent, &x, &y); + LLUI::getMousePositionLocal(mParent, &x, &y); mFlyoutMenu->updateParent(LLMenuGL::sMenuContainer); LLMenuGL::showPopup(mParent, mFlyoutMenu, x, y); diff --git a/indra/newview/llinspect.cpp b/indra/newview/llinspect.cpp index 21a6496c534c092eedb08729e83543937752db82..d9e91ad5ed12bdc93ca261551f1b8c62d1e8f877 100644 --- a/indra/newview/llinspect.cpp +++ b/indra/newview/llinspect.cpp @@ -138,7 +138,7 @@ bool LLInspect::childHasVisiblePopupMenu() LLRect floater_rc = calcScreenRect(); LLRect menu_screen_rc = child_menu->calcScreenRect(); S32 mx, my; - LLUI::getInstance()->getMousePositionScreen(&mx, &my); + LLUI::getMousePositionScreen(&mx, &my); // This works wrong if we spawn a menu near Inspector and menu overlaps Inspector. if(floater_rc.overlaps(menu_screen_rc) && menu_screen_rc.pointInRect(mx, my)) @@ -156,11 +156,11 @@ void LLInspect::repositionInspector(const LLSD& data) // See LLToolTipMgr::createToolTip if (data.has("pos")) { - LLUI::getInstance()->positionViewNearMouse(this, data["pos"]["x"].asInteger(), data["pos"]["y"].asInteger()); + LLUI::positionViewNearMouse(this, data["pos"]["x"].asInteger(), data["pos"]["y"].asInteger()); } else { - LLUI::getInstance()->positionViewNearMouse(this); + LLUI::positionViewNearMouse(this); } applyRectControl(); } diff --git a/indra/newview/llmaniptranslate.cpp b/indra/newview/llmaniptranslate.cpp index b40d8ab32dab48e34f4fc20d669aed24189603c3..e53ab91e1bf64eb4faaccc7ff535fcc3d1bbd28e 100644 --- a/indra/newview/llmaniptranslate.cpp +++ b/indra/newview/llmaniptranslate.cpp @@ -389,7 +389,7 @@ BOOL LLManipTranslate::handleMouseDownOnPart( S32 x, S32 y, MASK mask ) } else if (gSavedSettings.getBOOL("SnapToMouseCursor")) { - LLUI::getInstance()->setMousePositionScreen(mouse_pos.mX, mouse_pos.mY); + LLUI::setMousePositionScreen(mouse_pos.mX, mouse_pos.mY); x = mouse_pos.mX; y = mouse_pos.mY; } diff --git a/indra/newview/llmoveview.cpp b/indra/newview/llmoveview.cpp index ee8b3da6b07b5ec3ae14e81fb4b1f1656abc84e1..f7e9edeeb409970d29dfd982c138609a15862895 100644 --- a/indra/newview/llmoveview.cpp +++ b/indra/newview/llmoveview.cpp @@ -701,7 +701,7 @@ LLPanelStandStopFlying* LLPanelStandStopFlying::getStandStopFlyingPanel() panel->buildFromFile("panel_stand_stop_flying.xml"); panel->setVisible(FALSE); - //LLUI::getInstance()->getRootView()->addChild(panel); + //LLUI::getRootView()->addChild(panel); LL_INFOS() << "Build LLPanelStandStopFlying panel" << LL_ENDL; diff --git a/indra/newview/llnamelistctrl.cpp b/indra/newview/llnamelistctrl.cpp index 3209d23e430b7f127165c19fcee7444301871561..d7c5364fba0e27ca162b2f542719e02e72ac5f10 100644 --- a/indra/newview/llnamelistctrl.cpp +++ b/indra/newview/llnamelistctrl.cpp @@ -154,7 +154,7 @@ void LLNameListCtrl::mouseOverHighlightNthItem( S32 target_index ) bool is_mouse_over_name_cell = false; S32 mouse_x, mouse_y; - LLUI::getInstance()->getMousePositionLocal(this, &mouse_x, &mouse_y); + LLUI::getMousePositionLocal(this, &mouse_x, &mouse_y); S32 column_index = getColumnIndexFromOffset(mouse_x); LLScrollListItem* hit_item = hitItem(mouse_x, mouse_y); diff --git a/indra/newview/llnetmap.cpp b/indra/newview/llnetmap.cpp index 702197bce8438379441ec4e7a64b8967d8f6ebe4..8da1504f374f0b4d26c8aa4ee6f488a1ddbc1104 100644 --- a/indra/newview/llnetmap.cpp +++ b/indra/newview/llnetmap.cpp @@ -476,7 +476,7 @@ void LLNetMap::draw() S32 local_mouse_x; S32 local_mouse_y; //localMouse(&local_mouse_x, &local_mouse_y); - LLUI::getInstance()->getMousePositionLocal(this, &local_mouse_x, &local_mouse_y); + LLUI::getMousePositionLocal(this, &local_mouse_x, &local_mouse_y); mClosestAgentToCursor.setNull(); F32 closest_dist_squared = F32_MAX; // value will be overridden in the loop F32 min_pick_dist_squared = (mDotRadius * MIN_PICK_SCALE) * (mDotRadius * MIN_PICK_SCALE); @@ -1146,7 +1146,7 @@ BOOL LLNetMap::handleMouseUp( S32 x, S32 y, MASK mask ) LLRect clip_rect = getRect(); clip_rect.stretch(-8); clip_rect.clipPointToRect(mMouseDown.mX, mMouseDown.mY, local_x, local_y); - LLUI::getInstance()->setMousePositionLocal(this, local_x, local_y); + LLUI::setMousePositionLocal(this, local_x, local_y); // finish the pan mPanning = false; diff --git a/indra/newview/llsaveoutfitcombobtn.cpp b/indra/newview/llsaveoutfitcombobtn.cpp index b1cb6d08d023d4b17dbd00b5c33f7f140bfb1503..32295cd96f29b3c5acf352b8accb1e571b4579fa 100644 --- a/indra/newview/llsaveoutfitcombobtn.cpp +++ b/indra/newview/llsaveoutfitcombobtn.cpp @@ -56,7 +56,7 @@ LLSaveOutfitComboBtn::LLSaveOutfitComboBtn(LLPanel* parent, bool saveAsDefaultAc void LLSaveOutfitComboBtn::showSaveMenu() { S32 x, y; - LLUI::getInstance()->getMousePositionLocal(mParent, &x, &y); + LLUI::getMousePositionLocal(mParent, &x, &y); mSaveMenu->updateParent(LLMenuGL::sMenuContainer); LLMenuGL::showPopup(mParent, mSaveMenu, x, y); diff --git a/indra/newview/lltoast.cpp b/indra/newview/lltoast.cpp index bf56a10d4d343ec5441d8b64668ca31863f3bb2b..6a4bc9bc987c24d713a78975398b9319a84dc544 100644 --- a/indra/newview/lltoast.cpp +++ b/indra/newview/lltoast.cpp @@ -430,7 +430,7 @@ void LLToast::setVisible(BOOL show) void LLToast::updateHoveredState() { S32 x, y; - LLUI::getInstance()->getMousePositionScreen(&x, &y); + LLUI::getMousePositionScreen(&x, &y); LLRect panel_rc = mWrapperPanel->calcScreenRect(); LLRect button_rc; diff --git a/indra/newview/lltoolfocus.cpp b/indra/newview/lltoolfocus.cpp index 3df6dd5dcfcec867e11045f82215eaaa6b7137c4..9a527c5b00639161cbfaec69da85876f5e6dd863 100644 --- a/indra/newview/lltoolfocus.cpp +++ b/indra/newview/lltoolfocus.cpp @@ -296,12 +296,12 @@ BOOL LLToolCamera::handleMouseUp(S32 x, S32 y, MASK mask) BOOL success = LLViewerCamera::getInstance()->projectPosAgentToScreen(focus_pos, mouse_pos); if (success) { - LLUI::getInstance()->setMousePositionScreen(mouse_pos.mX, mouse_pos.mY); + LLUI::setMousePositionScreen(mouse_pos.mX, mouse_pos.mY); } } else if (mMouseSteering) { - LLUI::getInstance()->setMousePositionScreen(mMouseDownX, mMouseDownY); + LLUI::setMousePositionScreen(mMouseDownX, mMouseDownY); } else { @@ -311,7 +311,7 @@ BOOL LLToolCamera::handleMouseUp(S32 x, S32 y, MASK mask) else { // not a valid zoomable object - LLUI::getInstance()->setMousePositionScreen(mMouseDownX, mMouseDownY); + LLUI::setMousePositionScreen(mMouseDownX, mMouseDownY); } // calls releaseMouse() internally diff --git a/indra/newview/lltoolgrab.cpp b/indra/newview/lltoolgrab.cpp index 0be3d1f1db54db76aa2640b793312d6eaa9d3c57..f4c82aee094f808ccd84864c9dcd24279612311c 100644 --- a/indra/newview/lltoolgrab.cpp +++ b/indra/newview/lltoolgrab.cpp @@ -1029,7 +1029,7 @@ void LLToolGrabBase::onMouseCaptureLost() // ...move cursor "naturally", as if it had moved when hidden S32 x = mGrabPick.mMousePt.mX + mAccumDeltaX; S32 y = mGrabPick.mMousePt.mY + mAccumDeltaY; - LLUI::getInstance()->setMousePositionScreen(x, y); + LLUI::setMousePositionScreen(x, y); } else if (mHasMoved) { @@ -1039,13 +1039,13 @@ void LLToolGrabBase::onMouseCaptureLost() LLCoordGL gl_point; if (LLViewerCamera::getInstance()->projectPosAgentToScreen(grab_point_agent, gl_point)) { - LLUI::getInstance()->setMousePositionScreen(gl_point.mX, gl_point.mY); + LLUI::setMousePositionScreen(gl_point.mX, gl_point.mY); } } else { // ...move cursor back to click position - LLUI::getInstance()->setMousePositionScreen(mGrabPick.mMousePt.mX, mGrabPick.mMousePt.mY); + LLUI::setMousePositionScreen(mGrabPick.mMousePt.mX, mGrabPick.mMousePt.mY); } gViewerWindow->showCursor(); diff --git a/indra/newview/lluilistener.cpp b/indra/newview/lluilistener.cpp index 956f5cf187acecbabdc369c56a9e253dc5f35d9e..6b2cd71d406ac4a493eb6de9dd66a6b9d2b2d2b5 100644 --- a/indra/newview/lluilistener.cpp +++ b/indra/newview/lluilistener.cpp @@ -84,8 +84,8 @@ void LLUIListener::getValue(const LLSD&event) const { LLSD reply = LLSD::emptyMap(); - const LLView* root = LLUI::getInstance()->getRootView(); - const LLView* view = LLUI::getInstance()->resolvePath(root, event["path"].asString()); + const LLView* root = LLUI::getRootView(); + const LLView* view = LLUI::resolvePath(root, event["path"].asString()); const LLUICtrl* ctrl(dynamic_cast<const LLUICtrl*>(view)); if (ctrl) diff --git a/indra/newview/llurllineeditorctrl.cpp b/indra/newview/llurllineeditorctrl.cpp index 2b7e598a590cea853e8eb30d22efc0a635ac1f61..8a6111485264b7ea297fab407f3c558365c5c2df 100644 --- a/indra/newview/llurllineeditorctrl.cpp +++ b/indra/newview/llurllineeditorctrl.cpp @@ -66,7 +66,7 @@ void LLURLLineEditor::cut() if( need_to_rollback ) { rollback.doRollback( this ); - LLUI::getInstance()->reportBadKeystroke(); + LLUI::reportBadKeystroke(); } else if( mKeystrokeCallback ) diff --git a/indra/newview/llviewertexteditor.cpp b/indra/newview/llviewertexteditor.cpp index 7abb42dd8a2f01be90414967da93bf414621a5f8..f1222d9b326f6053fa9cd672346ec5f25941fe12 100644 --- a/indra/newview/llviewertexteditor.cpp +++ b/indra/newview/llviewertexteditor.cpp @@ -240,7 +240,7 @@ class LLEmbeddedItemSegment : public LLTextSegment /*virtual*/ BOOL handleHover(S32 x, S32 y, MASK mask) { - LLUI::getInstance()->getWindow()->setCursor(UI_CURSOR_HAND); + LLUI::getWindow()->setCursor(UI_CURSOR_HAND); return TRUE; } virtual BOOL handleToolTip(S32 x, S32 y, MASK mask ) diff --git a/indra/newview/llviewerwindow.cpp b/indra/newview/llviewerwindow.cpp index af25726a9495d8667721514ea3bc922469d9c688..1aa7871f2968994b59f6e829ab97048721f29596 100644 --- a/indra/newview/llviewerwindow.cpp +++ b/indra/newview/llviewerwindow.cpp @@ -989,7 +989,7 @@ BOOL LLViewerWindow::handleAnyMouseClick(LLWindow *window, LLCoordGL pos, MASK mWindow->releaseMouse(); // Indicate mouse was active - LLUI::getInstance()->resetMouseIdleTimer(); + LLUI::resetMouseIdleTimer(); // Don't let the user move the mouse out of the window until mouse up. if( LLToolMgr::getInstance()->getCurrentTool()->clipMouseWhenDown() ) @@ -1367,7 +1367,7 @@ void LLViewerWindow::handleMouseMove(LLWindow *window, LLCoordGL pos, MASK mask if (mouse_point != mCurrentMousePoint) { - LLUI::getInstance()->resetMouseIdleTimer(); + LLUI::resetMouseIdleTimer(); } saveLastMouse(mouse_point); @@ -1928,7 +1928,7 @@ LLViewerWindow::LLViewerWindow(const Params& p) rvp.mouse_opaque(false); rvp.follows.flags(FOLLOWS_NONE); mRootView = LLUICtrlFactory::create<LLRootView>(rvp); - LLUI::getInstance()->setRootView(mRootView); + LLUI::setRootView(mRootView); // Make avatar head look forward at start mCurrentMousePoint.mX = getWindowWidthScaled() / 2; @@ -2492,7 +2492,7 @@ void LLViewerWindow::setNormalControlsVisible( BOOL visible ) gStatusBar->setEnabled( visible ); } - LLNavigationBar* navbarp = LLUI::getInstance()->getRootView()->findChild<LLNavigationBar>("navigation_bar"); + LLNavigationBar* navbarp = LLUI::getRootView()->findChild<LLNavigationBar>("navigation_bar"); if (navbarp) { // when it's time to show navigation bar we need to ensure that the user wants to see it @@ -2997,7 +2997,7 @@ BOOL LLViewerWindow::handleUnicodeChar(llwchar uni_char, MASK mask) void LLViewerWindow::handleScrollWheel(S32 clicks) { - LLUI::getInstance()->resetMouseIdleTimer(); + LLUI::resetMouseIdleTimer(); LLMouseHandler* mouse_captor = gFocusMgr.getMouseCapture(); if( mouse_captor ) @@ -3047,7 +3047,7 @@ void LLViewerWindow::handleScrollWheel(S32 clicks) void LLViewerWindow::handleScrollHWheel(S32 clicks) { - LLUI::getInstance()->resetMouseIdleTimer(); + LLUI::resetMouseIdleTimer(); LLMouseHandler* mouse_captor = gFocusMgr.getMouseCapture(); if (mouse_captor) @@ -3120,7 +3120,7 @@ void LLViewerWindow::moveCursorToCenter() S32 x = getWorldViewWidthScaled() / 2; S32 y = getWorldViewHeightScaled() / 2; - LLUI::getInstance()->setMousePositionScreen(x, y); + LLUI::setMousePositionScreen(x, y); //on a forced move, all deltas get zeroed out to prevent jumping mCurrentMousePoint.set(x,y); diff --git a/indra/newview/llwindowlistener.cpp b/indra/newview/llwindowlistener.cpp index 161cadb5146516d5beeafee6297fbb32ae10986a..f92dd21038d927778e7da23b0199b0a7cc6a716c 100644 --- a/indra/newview/llwindowlistener.cpp +++ b/indra/newview/llwindowlistener.cpp @@ -68,7 +68,7 @@ LLWindowListener::LLWindowListener(LLViewerWindow *window, const KeyboardGetter& std::string buttonExplain = "(button values \"LEFT\", \"MIDDLE\", \"RIGHT\")\n"; std::string paramsExplain = - "[\"path\"] is as for LLUI::getInstance()->resolvePath(), described in\n" + "[\"path\"] is as for LLUI::resolvePath(), described in\n" "http://bitbucket.org/lindenlab/viewer-release/src/tip/indra/llui/llui.h\n" "If you omit [\"path\"], you must specify both [\"x\"] and [\"y\"].\n" "If you specify [\"path\"] without both [\"x\"] and [\"y\"], will synthesize (x, y)\n" @@ -208,7 +208,7 @@ void LLWindowListener::getInfo(LLSD const & evt) if (evt.has("path")) { std::string path(evt["path"]); - LLView * target_view = LLUI::getInstance()->resolvePath(LLUI::getInstance()->getRootView(), path); + LLView * target_view = LLUI::resolvePath(LLUI::getRootView(), path); if (target_view != 0) { response.setResponse(target_view->getInfo()); @@ -229,7 +229,7 @@ void LLWindowListener::getInfo(LLSD const & evt) void LLWindowListener::getPaths(LLSD const & request) { Response response(LLSD(), request); - LLView *root(LLUI::getInstance()->getRootView()), *base(NULL); + LLView *root(LLUI::getRootView()), *base(NULL); // Capturing request["under"] as string means we conflate the case in // which there is no ["under"] key with the case in which its value is the // empty string. That seems to make sense to me. @@ -242,7 +242,7 @@ void LLWindowListener::getPaths(LLSD const & request) } else { - base = LLUI::getInstance()->resolvePath(root, under); + base = LLUI::resolvePath(root, under); if (! base) { return response.error(STRINGIZE(request["op"].asString() << " request " @@ -267,7 +267,7 @@ void LLWindowListener::keyDown(LLSD const & evt) if (evt.has("path")) { std::string path(evt["path"]); - LLView * target_view = LLUI::getInstance()->resolvePath(LLUI::getInstance()->getRootView(), path); + LLView * target_view = LLUI::resolvePath(LLUI::getRootView(), path); if (target_view == 0) { response.error(STRINGIZE(evt["op"].asString() << " request " @@ -302,7 +302,7 @@ void LLWindowListener::keyUp(LLSD const & evt) if (evt.has("path")) { std::string path(evt["path"]); - LLView * target_view = LLUI::getInstance()->resolvePath(LLUI::getInstance()->getRootView(), path); + LLView * target_view = LLUI::resolvePath(LLUI::getRootView(), path); if (target_view == 0 ) { response.error(STRINGIZE(evt["op"].asString() << " request " @@ -406,8 +406,8 @@ static void mouseEvent(const MouseFunc& func, const LLSD& request) } else // ! path.empty() { - LLView* root = LLUI::getInstance()->getRootView(); - LLView* target = LLUI::getInstance()->resolvePath(root, path); + LLView* root = LLUI::getRootView(); + LLView* target = LLUI::resolvePath(root, path); if (! target) { return response.error(STRINGIZE(request["op"].asString() << " request " diff --git a/indra/newview/llworldmapview.cpp b/indra/newview/llworldmapview.cpp index 2b1bdcc39dc6db4e93a31a7234adc7cbf3af8566..1ac878a3f4ef0c5d87ff0d0660aaec9b04bef00e 100644 --- a/indra/newview/llworldmapview.cpp +++ b/indra/newview/llworldmapview.cpp @@ -1654,7 +1654,7 @@ BOOL LLWorldMapView::handleMouseUp( S32 x, S32 y, MASK mask ) LLRect clip_rect = getRect(); clip_rect.stretch(-8); clip_rect.clipPointToRect(mMouseDownX, mMouseDownY, local_x, local_y); - LLUI::getInstance()->setMousePositionLocal(this, local_x, local_y); + LLUI::setMousePositionLocal(this, local_x, local_y); // finish the pan mPanning = FALSE;