summaryrefslogtreecommitdiff
path: root/indra/llui
diff options
context:
space:
mode:
Diffstat (limited to 'indra/llui')
-rw-r--r--indra/llui/llaccordionctrltab.cpp2
-rw-r--r--indra/llui/llbutton.cpp12
-rw-r--r--indra/llui/llchatentry.cpp4
-rw-r--r--indra/llui/llcombobox.cpp4
-rw-r--r--indra/llui/llconsole.cpp4
-rw-r--r--indra/llui/llconsole.h2
-rw-r--r--indra/llui/llflashtimer.cpp4
-rw-r--r--indra/llui/llfloater.cpp20
-rw-r--r--indra/llui/llfloaterreg.cpp2
-rw-r--r--indra/llui/llfocusmgr.cpp4
-rw-r--r--indra/llui/llfolderview.cpp12
-rw-r--r--indra/llui/llfolderviewitem.cpp2
-rw-r--r--indra/llui/llfolderviewmodel.cpp2
-rw-r--r--indra/llui/lllayoutstack.cpp2
-rw-r--r--indra/llui/lllineeditor.cpp38
-rw-r--r--indra/llui/llmenugl.cpp2
-rw-r--r--indra/llui/llmodaldialog.cpp12
-rw-r--r--indra/llui/llnotifications.cpp15
-rw-r--r--indra/llui/llpanel.cpp4
-rw-r--r--indra/llui/llscrollbar.cpp6
-rw-r--r--indra/llui/llspellcheck.cpp31
-rw-r--r--indra/llui/llspellcheck.h21
-rw-r--r--indra/llui/llstatview.cpp4
-rw-r--r--indra/llui/lltextbase.cpp2
-rw-r--r--indra/llui/lltextbox.cpp2
-rw-r--r--indra/llui/lltexteditor.cpp16
-rw-r--r--indra/llui/lltextutil.cpp2
-rw-r--r--indra/llui/lltoggleablemenu.cpp2
-rw-r--r--indra/llui/lltoolbar.cpp2
-rw-r--r--indra/llui/lltooltip.cpp22
-rw-r--r--indra/llui/llui.cpp139
-rw-r--r--indra/llui/llui.h123
-rw-r--r--indra/llui/llurlentry.cpp2
-rw-r--r--indra/llui/llview.cpp20
-rw-r--r--indra/llui/llview.h2
-rw-r--r--indra/llui/llviewereventrecorder.cpp6
-rw-r--r--indra/llui/llviewinject.h2
37 files changed, 256 insertions, 295 deletions
diff --git a/indra/llui/llaccordionctrltab.cpp b/indra/llui/llaccordionctrltab.cpp
index eaf1284237..1034a21905 100644
--- a/indra/llui/llaccordionctrltab.cpp
+++ b/indra/llui/llaccordionctrltab.cpp
@@ -977,7 +977,7 @@ void LLAccordionCtrlTab::drawChild(const LLRect& root_rect,LLView* child)
LLRect screen_rect;
localRectToScreen(child->getRect(),&screen_rect);
- if ( root_rect.overlaps(screen_rect) && LLUI::sDirtyRect.overlaps(screen_rect))
+ if ( root_rect.overlaps(screen_rect) && LLUI::getInstance()->mDirtyRect.overlaps(screen_rect))
{
gGL.matrixMode(LLRender::MM_MODELVIEW);
LLUI::pushMatrix();
diff --git a/indra/llui/llbutton.cpp b/indra/llui/llbutton.cpp
index 6b7a8a8b86..27444b7f5b 100644
--- a/indra/llui/llbutton.cpp
+++ b/indra/llui/llbutton.cpp
@@ -90,8 +90,8 @@ LLButton::Params::Params()
image_overlay_disabled_color("image_overlay_disabled_color", LLColor4::white % 0.3f),
image_overlay_selected_color("image_overlay_selected_color", LLColor4::white),
flash_color("flash_color"),
- pad_right("pad_right", LLUI::sSettingGroups["config"]->getS32("ButtonHPad")),
- pad_left("pad_left", LLUI::sSettingGroups["config"]->getS32("ButtonHPad")),
+ pad_right("pad_right", LLUI::getInstance()->mSettingGroups["config"]->getS32("ButtonHPad")),
+ pad_left("pad_left", LLUI::getInstance()->mSettingGroups["config"]->getS32("ButtonHPad")),
pad_bottom("pad_bottom"),
click_callback("click_callback"),
mouse_down_callback("mouse_down_callback"),
@@ -614,7 +614,7 @@ void LLButton::getOverlayImageSize(S32& overlay_width, S32& overlay_height)
// virtual
void LLButton::draw()
{
- static LLCachedControl<bool> sEnableButtonFlashing(*LLUI::sSettingGroups["config"], "EnableButtonFlashing", true);
+ static LLCachedControl<bool> sEnableButtonFlashing(*LLUI::getInstance()->mSettingGroups["config"], "EnableButtonFlashing", true);
F32 alpha = mUseDrawContextAlpha ? getDrawContext().mAlpha : getCurrentTransparency();
bool pressed_by_keyboard = FALSE;
@@ -628,7 +628,7 @@ void LLButton::draw()
{
S32 local_mouse_x ;
S32 local_mouse_y;
- LLUI::getMousePositionLocal(this, &local_mouse_x, &local_mouse_y);
+ LLUI::getInstance()->getMousePositionLocal(this, &local_mouse_x, &local_mouse_y);
mouse_pressed_and_over = pointInView(local_mouse_x, local_mouse_y);
}
@@ -1261,10 +1261,10 @@ void LLButton::showHelp(LLUICtrl* ctrl, const LLSD& sdname)
// search back through the button's parents for a panel
// with a help_topic string defined
std::string help_topic;
- if (LLUI::sHelpImpl &&
+ if (LLUI::getInstance()->mHelpImpl &&
ctrl->findHelpTopic(help_topic))
{
- LLUI::sHelpImpl->showTopic(help_topic);
+ LLUI::getInstance()->mHelpImpl->showTopic(help_topic);
return; // success
}
diff --git a/indra/llui/llchatentry.cpp b/indra/llui/llchatentry.cpp
index dac001afab..c506576126 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::reportBadKeystroke();
+ LLUI::getInstance()->reportBadKeystroke();
}
handled = TRUE;
}
@@ -225,7 +225,7 @@ BOOL LLChatEntry::handleSpecialKey(const KEY key, const MASK mask)
}
else
{
- LLUI::reportBadKeystroke();
+ LLUI::getInstance()->reportBadKeystroke();
}
handled = TRUE;
}
diff --git a/indra/llui/llcombobox.cpp b/indra/llui/llcombobox.cpp
index b2ad38bddf..c7f0326ed4 100644
--- a/indra/llui/llcombobox.cpp
+++ b/indra/llui/llcombobox.cpp
@@ -668,7 +668,7 @@ void LLComboBox::showList()
mButton->setToggleState(TRUE);
mList->setVisible(TRUE);
- LLUI::addPopup(this);
+ LLUI::getInstance()->addPopup(this);
setUseBoundingRect(TRUE);
// updateBoundingRect();
@@ -694,7 +694,7 @@ void LLComboBox::hideList()
mList->mouseOverHighlightNthItem(-1);
setUseBoundingRect(FALSE);
- LLUI::removePopup(this);
+ LLUI::getInstance()->removePopup(this);
// updateBoundingRect();
}
}
diff --git a/indra/llui/llconsole.cpp b/indra/llui/llconsole.cpp
index 26ae31cac6..5f50e46233 100644
--- a/indra/llui/llconsole.cpp
+++ b/indra/llui/llconsole.cpp
@@ -68,7 +68,7 @@ LLConsole::LLConsole(const LLConsole::Params& p)
setFontSize(p.font_size_index);
}
mFadeTime = mLinePersistTime - FADE_DURATION;
- setMaxLines(LLUI::sSettingGroups["config"]->getS32("ConsoleMaxLines"));
+ setMaxLines(LLUI::getInstance()->mSettingGroups["config"]->getS32("ConsoleMaxLines"));
}
void LLConsole::setLinePersistTime(F32 seconds)
@@ -180,7 +180,7 @@ void LLConsole::draw()
LLUIImagePtr imagep = LLUI::getUIImage("transparent");
- F32 console_opacity = llclamp(LLUI::sSettingGroups["config"]->getF32("ConsoleBackgroundOpacity"), 0.f, 1.f);
+ F32 console_opacity = llclamp(LLUI::getInstance()->mSettingGroups["config"]->getF32("ConsoleBackgroundOpacity"), 0.f, 1.f);
LLColor4 color = LLUIColorTable::instance().getColor("ConsoleBackground");
color.mV[VALPHA] *= console_opacity;
diff --git a/indra/llui/llconsole.h b/indra/llui/llconsole.h
index 5ff05698b0..04f5e71609 100644
--- a/indra/llui/llconsole.h
+++ b/indra/llui/llconsole.h
@@ -51,7 +51,7 @@ public:
Optional<F32> persist_time;
Optional<S32> font_size_index;
Params()
- : max_lines("max_lines", LLUI::sSettingGroups["config"]->getS32("ConsoleMaxLines")),
+ : max_lines("max_lines", LLUI::getInstance()->mSettingGroups["config"]->getS32("ConsoleMaxLines")),
persist_time("persist_time", 0.f), // forever
font_size_index("font_size_index")
{
diff --git a/indra/llui/llflashtimer.cpp b/indra/llui/llflashtimer.cpp
index 6d9c429b08..39793316f4 100644
--- a/indra/llui/llflashtimer.cpp
+++ b/indra/llui/llflashtimer.cpp
@@ -40,10 +40,10 @@ LLFlashTimer::LLFlashTimer(callback_t cb, S32 count, F32 period)
// By default use settings from settings.xml to be able change them via Debug settings. See EXT-5973.
// Due to Timer is implemented as derived class from EventTimer it is impossible to change period
// in runtime. So, both settings are made as required restart.
- mFlashCount = 2 * ((count > 0) ? count : LLUI::sSettingGroups["config"]->getS32("FlashCount"));
+ mFlashCount = 2 * ((count > 0) ? count : LLUI::getInstance()->mSettingGroups["config"]->getS32("FlashCount"));
if (mPeriod <= 0)
{
- mPeriod = LLUI::sSettingGroups["config"]->getF32("FlashPeriod");
+ mPeriod = LLUI::getInstance()->mSettingGroups["config"]->getF32("FlashPeriod");
}
}
diff --git a/indra/llui/llfloater.cpp b/indra/llui/llfloater.cpp
index a245dd8f78..42802cd339 100644
--- a/indra/llui/llfloater.cpp
+++ b/indra/llui/llfloater.cpp
@@ -215,14 +215,14 @@ void LLFloater::initClass()
sButtonToolTips[i] = LLTrans::getString( sButtonToolTipsIndex[i] );
}
- LLControlVariable* ctrl = LLUI::sSettingGroups["config"]->getControl("ActiveFloaterTransparency").get();
+ LLControlVariable* ctrl = LLUI::getInstance()->mSettingGroups["config"]->getControl("ActiveFloaterTransparency").get();
if (ctrl)
{
ctrl->getSignal()->connect(boost::bind(&LLFloater::updateActiveFloaterTransparency));
updateActiveFloaterTransparency();
}
- ctrl = LLUI::sSettingGroups["config"]->getControl("InactiveFloaterTransparency").get();
+ ctrl = LLUI::getInstance()->mSettingGroups["config"]->getControl("InactiveFloaterTransparency").get();
if (ctrl)
{
ctrl->getSignal()->connect(boost::bind(&LLFloater::updateInactiveFloaterTransparency));
@@ -374,13 +374,13 @@ void LLFloater::layoutDragHandle()
// static
void LLFloater::updateActiveFloaterTransparency()
{
- sActiveControlTransparency = LLUI::sSettingGroups["config"]->getF32("ActiveFloaterTransparency");
+ sActiveControlTransparency = LLUI::getInstance()->mSettingGroups["config"]->getF32("ActiveFloaterTransparency");
}
// static
void LLFloater::updateInactiveFloaterTransparency()
{
- sInactiveControlTransparency = LLUI::sSettingGroups["config"]->getF32("InactiveFloaterTransparency");
+ sInactiveControlTransparency = LLUI::getInstance()->mSettingGroups["config"]->getF32("InactiveFloaterTransparency");
}
void LLFloater::addResizeCtrls()
@@ -579,7 +579,7 @@ std::string LLFloater::getControlName(const std::string& name, const LLSD& key)
LLControlGroup* LLFloater::getControlGroup()
{
// Floater size, position, visibility, etc are saved in per-account settings.
- return LLUI::sSettingGroups["account"];
+ return LLUI::getInstance()->mSettingGroups["account"];
}
void LLFloater::setVisible( BOOL visible )
@@ -592,7 +592,7 @@ void LLFloater::setVisible( BOOL visible )
if( !visible )
{
- LLUI::removePopup(this);
+ LLUI::getInstance()->removePopup(this);
if( gFocusMgr.childHasMouseCapture( this ) )
{
@@ -818,7 +818,7 @@ void LLFloater::reshape(S32 width, S32 height, BOOL called_from_parent)
void LLFloater::releaseFocus()
{
- LLUI::removePopup(this);
+ LLUI::getInstance()->removePopup(this);
setFocus(FALSE);
@@ -1771,13 +1771,13 @@ void LLFloater::onClickDock(LLFloater* self)
// static
void LLFloater::onClickHelp( LLFloater* self )
{
- if (self && LLUI::sHelpImpl)
+ if (self && LLUI::getInstance()->mHelpImpl)
{
// find the current help context for this floater
std::string help_topic;
if (self->findHelpTopic(help_topic))
{
- LLUI::sHelpImpl->showTopic(help_topic);
+ LLUI::getInstance()->mHelpImpl->showTopic(help_topic);
}
}
}
@@ -2931,7 +2931,7 @@ void LLFloaterView::syncFloaterTabOrder()
if (modal_dialog)
{
// If we have a visible modal dialog, make sure that it has focus
- LLUI::addPopup(modal_dialog);
+ LLUI::getInstance()->addPopup(modal_dialog);
if( !gFocusMgr.childHasKeyboardFocus( modal_dialog ) )
{
diff --git a/indra/llui/llfloaterreg.cpp b/indra/llui/llfloaterreg.cpp
index 9ef290abc0..85e07fc6a6 100644
--- a/indra/llui/llfloaterreg.cpp
+++ b/indra/llui/llfloaterreg.cpp
@@ -445,7 +445,7 @@ void LLFloaterReg::registerControlVariables()
}
}
- const LLSD& exclude_list = LLUI::sSettingGroups["config"]->getLLSD("always_showable_floaters");
+ const LLSD& exclude_list = LLUI::getInstance()->mSettingGroups["config"]->getLLSD("always_showable_floaters");
for (LLSD::array_const_iterator iter = exclude_list.beginArray();
iter != exclude_list.endArray();
iter++)
diff --git a/indra/llui/llfocusmgr.cpp b/indra/llui/llfocusmgr.cpp
index 1b213c3418..7b0a6cbdae 100644
--- a/indra/llui/llfocusmgr.cpp
+++ b/indra/llui/llfocusmgr.cpp
@@ -183,7 +183,7 @@ void LLFocusMgr::releaseFocusIfNeeded( LLView* view )
}
}
- LLUI::removePopup(view);
+ LLUI::getInstance()->removePopup(view);
}
void LLFocusMgr::setKeyboardFocus(LLFocusableElement* new_focus, BOOL lock, BOOL keystrokes_only)
@@ -481,7 +481,7 @@ void LLFocusMgr::setAppHasFocus(BOOL focus)
// release focus from "top ctrl"s, which generally hides them
if (!focus)
{
- LLUI::clearPopups();
+ LLUI::getInstance()->clearPopups();
}
mAppHasFocus = focus;
}
diff --git a/indra/llui/llfolderview.cpp b/indra/llui/llfolderview.cpp
index 895753aeae..b05a9807d0 100644
--- a/indra/llui/llfolderview.cpp
+++ b/indra/llui/llfolderview.cpp
@@ -338,7 +338,7 @@ static LLTrace::BlockTimerStatHandle FTM_FILTER("Filter Folder View");
void LLFolderView::filter( LLFolderViewFilter& filter )
{
LL_RECORD_BLOCK_TIME(FTM_FILTER);
- filter.resetTime(llclamp(LLUI::sSettingGroups["config"]->getS32(mParentPanel.get()->getVisible() ? "FilterItemsMaxTimePerFrameVisible" : "FilterItemsMaxTimePerFrameUnvisible"), 1, 100));
+ filter.resetTime(llclamp(LLUI::getInstance()->mSettingGroups["config"]->getS32(mParentPanel.get()->getVisible() ? "FilterItemsMaxTimePerFrameVisible" : "FilterItemsMaxTimePerFrameUnvisible"), 1, 100));
// Note: we filter the model, not the view
getViewModelItem()->filter(filter);
@@ -657,7 +657,7 @@ void LLFolderView::draw()
closeAutoOpenedFolders();
}
- if (mSearchTimer.getElapsedTimeF32() > LLUI::sSettingGroups["config"]->getF32("TypeAheadTimeout") || !mSearchString.size())
+ if (mSearchTimer.getElapsedTimeF32() > LLUI::getInstance()->mSettingGroups["config"]->getF32("TypeAheadTimeout") || !mSearchString.size())
{
mSearchString.clear();
}
@@ -733,7 +733,7 @@ void LLFolderView::closeRenamer( void )
if (mRenamer && mRenamer->getVisible())
{
// Triggers onRenamerLost() that actually closes the renamer.
- LLUI::removePopup(mRenamer);
+ LLUI::getInstance()->removePopup(mRenamer);
}
}
@@ -1064,7 +1064,7 @@ void LLFolderView::startRenamingSelectedItem( void )
// set focus will fail unless item is visible
mRenamer->setFocus( TRUE );
mRenamer->setTopLostCallback(boost::bind(&LLFolderView::onRenamerLost, this));
- LLUI::addPopup(mRenamer);
+ LLUI::getInstance()->addPopup(mRenamer);
}
}
@@ -1321,7 +1321,7 @@ BOOL LLFolderView::handleUnicodeCharHere(llwchar uni_char)
}
//do text search
- if (mSearchTimer.getElapsedTimeF32() > LLUI::sSettingGroups["config"]->getF32("TypeAheadTimeout"))
+ if (mSearchTimer.getElapsedTimeF32() > LLUI::getInstance()->mSettingGroups["config"]->getF32("TypeAheadTimeout"))
{
mSearchString.clear();
}
@@ -1803,7 +1803,7 @@ void LLFolderView::updateRenamerPosition()
screenPointToLocal( x, y, &x, &y );
mRenamer->setOrigin( x, y );
- LLRect scroller_rect(0, 0, (S32)LLUI::getWindowSize().mV[VX], 0);
+ LLRect scroller_rect(0, 0, (S32)LLUI::getInstance()->getWindowSize().mV[VX], 0);
if (mScrollContainer)
{
scroller_rect = mScrollContainer->getContentWindowRect();
diff --git a/indra/llui/llfolderviewitem.cpp b/indra/llui/llfolderviewitem.cpp
index 0510e472c5..2de47f1a19 100644
--- a/indra/llui/llfolderviewitem.cpp
+++ b/indra/llui/llfolderviewitem.cpp
@@ -548,7 +548,7 @@ BOOL LLFolderViewItem::handleMouseDown( S32 x, S32 y, MASK mask )
BOOL LLFolderViewItem::handleHover( S32 x, S32 y, MASK mask )
{
- static LLCachedControl<S32> drag_and_drop_threshold(*LLUI::sSettingGroups["config"],"DragAndDropDistanceThreshold", 3);
+ static LLCachedControl<S32> drag_and_drop_threshold(*LLUI::getInstance()->mSettingGroups["config"],"DragAndDropDistanceThreshold", 3);
mIsMouseOverTitle = (y > (getRect().getHeight() - mItemHeight));
diff --git a/indra/llui/llfolderviewmodel.cpp b/indra/llui/llfolderviewmodel.cpp
index 3363dc5316..3b45fb53a2 100644
--- a/indra/llui/llfolderviewmodel.cpp
+++ b/indra/llui/llfolderviewmodel.cpp
@@ -48,7 +48,7 @@ std::string LLFolderViewModelCommon::getStatusText()
void LLFolderViewModelCommon::filter()
{
- getFilter().resetTime(llclamp(LLUI::sSettingGroups["config"]->getS32("FilterItemsMaxTimePerFrameVisible"), 1, 100));
+ getFilter().resetTime(llclamp(LLUI::getInstance()->mSettingGroups["config"]->getS32("FilterItemsMaxTimePerFrameVisible"), 1, 100));
mFolderView->getViewModelItem()->filter(getFilter());
}
diff --git a/indra/llui/lllayoutstack.cpp b/indra/llui/lllayoutstack.cpp
index 955e7089f4..4a464b3507 100644
--- a/indra/llui/lllayoutstack.cpp
+++ b/indra/llui/lllayoutstack.cpp
@@ -209,7 +209,7 @@ LLLayoutStack::Params::Params()
open_time_constant("open_time_constant", 0.02f),
close_time_constant("close_time_constant", 0.03f),
resize_bar_overlap("resize_bar_overlap", 1),
- border_size("border_size", LLCachedControl<S32>(*LLUI::sSettingGroups["config"], "UIResizeBarHeight", 0)),
+ border_size("border_size", LLCachedControl<S32>(*LLUI::getInstance()->mSettingGroups["config"], "UIResizeBarHeight", 0)),
show_drag_handle("show_drag_handle", false),
drag_handle_first_indent("drag_handle_first_indent", 0),
drag_handle_second_indent("drag_handle_second_indent", 0),
diff --git a/indra/llui/lllineeditor.cpp b/indra/llui/lllineeditor.cpp
index ff8bf30319..3ad504d68d 100644
--- a/indra/llui/lllineeditor.cpp
+++ b/indra/llui/lllineeditor.cpp
@@ -941,7 +941,7 @@ void LLLineEditor::removeChar()
}
else
{
- LLUI::reportBadKeystroke();
+ LLUI::getInstance()->reportBadKeystroke();
}
}
@@ -992,7 +992,7 @@ void LLLineEditor::addChar(const llwchar uni_char)
}
else
{
- LLUI::reportBadKeystroke();
+ LLUI::getInstance()->reportBadKeystroke();
}
getWindow()->hideCursorUntilMouseMove();
@@ -1088,7 +1088,7 @@ BOOL LLLineEditor::handleSelectionKey(KEY key, MASK mask)
}
else
{
- LLUI::reportBadKeystroke();
+ LLUI::getInstance()->reportBadKeystroke();
}
break;
@@ -1104,7 +1104,7 @@ BOOL LLLineEditor::handleSelectionKey(KEY key, MASK mask)
}
else
{
- LLUI::reportBadKeystroke();
+ LLUI::getInstance()->reportBadKeystroke();
}
break;
@@ -1184,7 +1184,7 @@ void LLLineEditor::cut()
if( need_to_rollback )
{
rollback.doRollback( this );
- LLUI::reportBadKeystroke();
+ LLUI::getInstance()->reportBadKeystroke();
}
else
{
@@ -1288,7 +1288,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::reportBadKeystroke();
+ LLUI::getInstance()->reportBadKeystroke();
}
if (mMaxLengthChars)
@@ -1300,7 +1300,7 @@ void LLLineEditor::pasteHelper(bool is_primary)
clean_string = clean_string.substr(0, available_chars);
}
- LLUI::reportBadKeystroke();
+ LLUI::getInstance()->reportBadKeystroke();
}
mText.insert(getCursor(), clean_string);
@@ -1312,7 +1312,7 @@ void LLLineEditor::pasteHelper(bool is_primary)
if( need_to_rollback )
{
rollback.doRollback( this );
- LLUI::reportBadKeystroke();
+ LLUI::getInstance()->reportBadKeystroke();
}
else
{
@@ -1376,7 +1376,7 @@ BOOL LLLineEditor::handleSpecialKey(KEY key, MASK mask)
}
else
{
- LLUI::reportBadKeystroke();
+ LLUI::getInstance()->reportBadKeystroke();
}
}
handled = TRUE;
@@ -1425,7 +1425,7 @@ BOOL LLLineEditor::handleSpecialKey(KEY key, MASK mask)
}
else
{
- LLUI::reportBadKeystroke();
+ LLUI::getInstance()->reportBadKeystroke();
}
handled = TRUE;
}
@@ -1452,7 +1452,7 @@ BOOL LLLineEditor::handleSpecialKey(KEY key, MASK mask)
}
else
{
- LLUI::reportBadKeystroke();
+ LLUI::getInstance()->reportBadKeystroke();
}
handled = TRUE;
}
@@ -1469,7 +1469,7 @@ BOOL LLLineEditor::handleSpecialKey(KEY key, MASK mask)
}
else
{
- LLUI::reportBadKeystroke();
+ LLUI::getInstance()->reportBadKeystroke();
}
handled = TRUE;
}
@@ -1486,7 +1486,7 @@ BOOL LLLineEditor::handleSpecialKey(KEY key, MASK mask)
}
else
{
- LLUI::reportBadKeystroke();
+ LLUI::getInstance()->reportBadKeystroke();
}
handled = TRUE;
}
@@ -1567,7 +1567,7 @@ BOOL LLLineEditor::handleKeyHere(KEY key, MASK mask )
{
rollback.doRollback(this);
- LLUI::reportBadKeystroke();
+ LLUI::getInstance()->reportBadKeystroke();
}
// Notify owner if requested
@@ -1623,7 +1623,7 @@ BOOL LLLineEditor::handleUnicodeCharHere(llwchar uni_char)
{
rollback.doRollback( this );
- LLUI::reportBadKeystroke();
+ LLUI::getInstance()->reportBadKeystroke();
}
// Notify owner if requested
@@ -1674,7 +1674,7 @@ void LLLineEditor::doDelete()
if( need_to_rollback )
{
rollback.doRollback( this );
- LLUI::reportBadKeystroke();
+ LLUI::getInstance()->reportBadKeystroke();
}
else
{
@@ -2478,7 +2478,7 @@ BOOL LLLineEditor::getPreeditLocation(S32 query_offset, LLCoordGL *coord, LLRect
{
LLRect control_rect_screen;
localRectToScreen(getRect(), &control_rect_screen);
- LLUI::screenRectToGL(control_rect_screen, control);
+ LLUI::getInstance()->screenRectToGL(control_rect_screen, control);
}
S32 preedit_left_column, preedit_right_column;
@@ -2508,7 +2508,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::screenPointToGL(query_screen_x, query_screen_y, &coord->mX, &coord->mY);
+ LLUI::getInstance()->screenPointToGL(query_screen_x, query_screen_y, &coord->mX, &coord->mY);
}
if (bounds)
@@ -2524,7 +2524,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::screenRectToGL(preedit_rect_screen, bounds);
+ LLUI::getInstance()->screenRectToGL(preedit_rect_screen, bounds);
}
return TRUE;
diff --git a/indra/llui/llmenugl.cpp b/indra/llui/llmenugl.cpp
index 676c94468f..732fa9feb1 100644
--- a/indra/llui/llmenugl.cpp
+++ b/indra/llui/llmenugl.cpp
@@ -3269,7 +3269,7 @@ void LLMenuGL::showPopup(LLView* spawning_view, LLMenuGL* menu, S32 x, S32 y)
menu->needsArrange();
menu->arrangeAndClear();
- LLUI::getMousePositionLocal(menu->getParent(), &mouse_x, &mouse_y);
+ LLUI::getInstance()->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 8cf88ad5eb..5cfa8ea973 100644
--- a/indra/llui/llmodaldialog.cpp
+++ b/indra/llui/llmodaldialog.cpp
@@ -105,7 +105,7 @@ void LLModalDialog::onOpen(const LLSD& key)
// This is a modal dialog. It sucks up all mouse and keyboard operations.
gFocusMgr.setMouseCapture( this );
- LLUI::addPopup(this);
+ LLUI::getInstance()->addPopup(this);
setFocus(TRUE);
sModalStack.push_front( this );
@@ -147,7 +147,7 @@ void LLModalDialog::setVisible( BOOL visible )
gFocusMgr.setMouseCapture( this );
// The dialog view is a root view
- LLUI::addPopup(this);
+ LLUI::getInstance()->addPopup(this);
setFocus( TRUE );
}
else
@@ -165,7 +165,7 @@ BOOL LLModalDialog::handleMouseDown(S32 x, S32 y, MASK mask)
if (popup_menu != NULL)
{
S32 mx, my;
- LLUI::getMousePositionScreen(&mx, &my);
+ LLUI::getInstance()->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::getMousePositionScreen(&mx, &my);
+ LLUI::getInstance()->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::getWindowSize();
+ LLVector2 window_size = LLUI::getInstance()->getWindowSize();
centerWithin(LLRect(0, 0, ll_round(window_size.mV[VX]), ll_round(window_size.mV[VY])));
}
@@ -316,7 +316,7 @@ void LLModalDialog::onAppFocusGained()
// This is a modal dialog. It sucks up all mouse and keyboard operations.
gFocusMgr.setMouseCapture( instance );
instance->setFocus(TRUE);
- LLUI::addPopup(instance);
+ LLUI::getInstance()->addPopup(instance);
instance->centerOnScreen();
}
diff --git a/indra/llui/llnotifications.cpp b/indra/llui/llnotifications.cpp
index 2e6dc6731b..6a7075301b 100644
--- a/indra/llui/llnotifications.cpp
+++ b/indra/llui/llnotifications.cpp
@@ -131,7 +131,7 @@ bool handleIgnoredNotification(const LLSD& payload)
response = pNotif->getResponseTemplate(LLNotification::WITH_DEFAULT_BUTTON);
break;
case LLNotificationForm::IGNORE_WITH_LAST_RESPONSE:
- response = LLUI::sSettingGroups["ignores"]->getLLSD("Default" + pNotif->getName());
+ response = LLUI::getInstance()->mSettingGroups["ignores"]->getLLSD("Default" + pNotif->getName());
break;
case LLNotificationForm::IGNORE_SHOW_AGAIN:
break;
@@ -199,6 +199,7 @@ LLNotificationForm::LLNotificationForm(const std::string& name, const LLNotifica
// For all cases but IGNORE_CHECKBOX_ONLY this is name for use in preferences
mIgnoreMsg = p.ignore.text;
+ LLUI *ui_inst = LLUI::getInstance();
if (p.ignore.checkbox_only)
{
mIgnore = IGNORE_CHECKBOX_ONLY;
@@ -211,19 +212,19 @@ LLNotificationForm::LLNotificationForm(const std::string& name, const LLNotifica
{
// remember last option chosen by user and automatically respond with that in the future
mIgnore = IGNORE_WITH_LAST_RESPONSE;
- LLUI::sSettingGroups["ignores"]->declareLLSD(std::string("Default") + name, "", std::string("Default response for notification " + name));
+ ui_inst->mSettingGroups["ignores"]->declareLLSD(std::string("Default") + name, "", std::string("Default response for notification " + name));
}
BOOL show_notification = TRUE;
if (p.ignore.control.isProvided())
{
- mIgnoreSetting = LLUI::sSettingGroups["config"]->getControl(p.ignore.control);
+ mIgnoreSetting = ui_inst->mSettingGroups["config"]->getControl(p.ignore.control);
mInvertSetting = p.ignore.invert_control;
}
else if (mIgnore > IGNORE_NO)
{
- LLUI::sSettingGroups["ignores"]->declareBOOL(name, show_notification, "Show notification with this name", LLControlVariable::PERSIST_NONDFT);
- mIgnoreSetting = LLUI::sSettingGroups["ignores"]->getControl(name);
+ ui_inst->mSettingGroups["ignores"]->declareBOOL(name, show_notification, "Show notification with this name", LLControlVariable::PERSIST_NONDFT);
+ mIgnoreSetting = ui_inst->mSettingGroups["ignores"]->getControl(name);
}
}
@@ -437,7 +438,7 @@ LLNotificationTemplate::LLNotificationTemplate(const LLNotificationTemplate::Par
mSoundName("")
{
if (p.sound.isProvided()
- && LLUI::sSettingGroups["config"]->controlExists(p.sound))
+ && LLUI::getInstance()->mSettingGroups["config"]->controlExists(p.sound))
{
mSoundName = p.sound;
}
@@ -705,7 +706,7 @@ void LLNotification::respond(const LLSD& response)
mForm->setIgnored(mIgnored);
if (mIgnored && mForm->getIgnoreType() == LLNotificationForm::IGNORE_WITH_LAST_RESPONSE)
{
- LLUI::sSettingGroups["ignores"]->setLLSD("Default" + getName(), response);
+ LLUI::getInstance()->mSettingGroups["ignores"]->setLLSD("Default" + getName(), response);
}
}
diff --git a/indra/llui/llpanel.cpp b/indra/llui/llpanel.cpp
index ee90574161..00da0f5fec 100644
--- a/indra/llui/llpanel.cpp
+++ b/indra/llui/llpanel.cpp
@@ -609,7 +609,7 @@ std::string LLPanel::getString(const std::string& name, const LLStringUtil::form
return formatted_string.getString();
}
std::string err_str("Failed to find string " + name + " in panel " + getName()); //*TODO: Translate
- if(LLUI::sSettingGroups["config"]->getBOOL("QAMode"))
+ if(LLUI::getInstance()->mSettingGroups["config"]->getBOOL("QAMode"))
{
LL_ERRS() << err_str << LL_ENDL;
}
@@ -628,7 +628,7 @@ std::string LLPanel::getString(const std::string& name) const
return found_it->second;
}
std::string err_str("Failed to find string " + name + " in panel " + getName()); //*TODO: Translate
- if(LLUI::sSettingGroups["config"]->getBOOL("QAMode"))
+ if(LLUI::getInstance()->mSettingGroups["config"]->getBOOL("QAMode"))
{
LL_ERRS() << err_str << LL_ENDL;
}
diff --git a/indra/llui/llscrollbar.cpp b/indra/llui/llscrollbar.cpp
index 25daf9db8b..fde6de4921 100644
--- a/indra/llui/llscrollbar.cpp
+++ b/indra/llui/llscrollbar.cpp
@@ -84,7 +84,7 @@ LLScrollbar::LLScrollbar(const Params & p)
mThumbImageH(p.thumb_image_horizontal),
mTrackImageV(p.track_image_vertical),
mTrackImageH(p.track_image_horizontal),
- mThickness(p.thickness.isProvided() ? p.thickness : LLUI::sSettingGroups["config"]->getS32("UIScrollbarSize")),
+ mThickness(p.thickness.isProvided() ? p.thickness : LLUI::getInstance()->mSettingGroups["config"]->getS32("UIScrollbarSize")),
mBGVisible(p.bg_visible),
mBGColor(p.bg_color)
{
@@ -498,7 +498,7 @@ void LLScrollbar::draw()
S32 local_mouse_x;
S32 local_mouse_y;
- LLUI::getMousePositionLocal(this, &local_mouse_x, &local_mouse_y);
+ LLUI::getInstance()->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)
@@ -655,5 +655,5 @@ void LLScrollbar::onLineDownBtnPressed( const LLSD& data )
void LLScrollbar::setThickness(S32 thickness)
{
- mThickness = thickness < 0 ? LLUI::sSettingGroups["config"]->getS32("UIScrollbarSize") : thickness;
+ mThickness = thickness < 0 ? LLUI::getInstance()->mSettingGroups["config"]->getS32("UIScrollbarSize") : thickness;
}
diff --git a/indra/llui/llspellcheck.cpp b/indra/llui/llspellcheck.cpp
index 7f64743e99..296ea09079 100644
--- a/indra/llui/llspellcheck.cpp
+++ b/indra/llui/llspellcheck.cpp
@@ -44,7 +44,6 @@ static const std::string DICT_FILE_IGNORE = "user_ignore.dic";
static const std::string DICT_FILE_MAIN = "dictionaries.xml";
static const std::string DICT_FILE_USER = "user_dictionaries.xml";
-LLSD LLSpellChecker::sDictMap;
LLSpellChecker::settings_change_signal_t LLSpellChecker::sSettingsChangeSignal;
LLSpellChecker::LLSpellChecker()
@@ -94,10 +93,9 @@ S32 LLSpellChecker::getSuggestions(const std::string& word, std::vector<std::str
return suggestions.size();
}
-// static
const LLSD LLSpellChecker::getDictionaryData(const std::string& dict_language)
{
- for (LLSD::array_const_iterator it = sDictMap.beginArray(); it != sDictMap.endArray(); ++it)
+ for (LLSD::array_const_iterator it = mDictMap.beginArray(); it != mDictMap.endArray(); ++it)
{
const LLSD& dict_entry = *it;
if (dict_language == dict_entry["language"].asString())
@@ -108,14 +106,12 @@ const LLSD LLSpellChecker::getDictionaryData(const std::string& dict_language)
return LLSD();
}
-// static
bool LLSpellChecker::hasDictionary(const std::string& dict_language, bool check_installed)
{
const LLSD dict_info = getDictionaryData(dict_language);
return dict_info.has("language") && ( (!check_installed) || (dict_info["installed"].asBoolean()) );
}
-// static
void LLSpellChecker::setDictionaryData(const LLSD& dict_info)
{
const std::string dict_language = dict_info["language"].asString();
@@ -124,7 +120,7 @@ void LLSpellChecker::setDictionaryData(const LLSD& dict_info)
return;
}
- for (LLSD::array_iterator it = sDictMap.beginArray(); it != sDictMap.endArray(); ++it)
+ for (LLSD::array_iterator it = mDictMap.beginArray(); it != mDictMap.endArray(); ++it)
{
LLSD& dict_entry = *it;
if (dict_language == dict_entry["language"].asString())
@@ -133,7 +129,7 @@ void LLSpellChecker::setDictionaryData(const LLSD& dict_info)
return;
}
}
- sDictMap.append(dict_info);
+ mDictMap.append(dict_info);
return;
}
@@ -147,14 +143,14 @@ void LLSpellChecker::refreshDictionaryMap()
std::string user_filename(user_path + DICT_FILE_MAIN);
llifstream user_file(user_filename.c_str(), std::ios::binary);
if ( (!user_file.is_open())
- || (LLSDParser::PARSE_FAILURE == LLSDSerialize::fromXMLDocument(sDictMap, user_file))
- || (0 == sDictMap.size()) )
+ || (LLSDParser::PARSE_FAILURE == LLSDSerialize::fromXMLDocument(mDictMap, user_file))
+ || (0 == mDictMap.size()) )
{
std::string app_filename(app_path + DICT_FILE_MAIN);
llifstream app_file(app_filename.c_str(), std::ios::binary);
if ( (!app_file.is_open())
- || (LLSDParser::PARSE_FAILURE == LLSDSerialize::fromXMLDocument(sDictMap, app_file))
- || (0 == sDictMap.size()) )
+ || (LLSDParser::PARSE_FAILURE == LLSDSerialize::fromXMLDocument(mDictMap, app_file))
+ || (0 == mDictMap.size()) )
{
return;
}
@@ -178,7 +174,7 @@ void LLSpellChecker::refreshDictionaryMap()
// Look for installed dictionaries
std::string tmp_app_path, tmp_user_path;
- for (LLSD::array_iterator it = sDictMap.beginArray(); it != sDictMap.endArray(); ++it)
+ for (LLSD::array_iterator it = mDictMap.beginArray(); it != mDictMap.endArray(); ++it)
{
LLSD& sdDict = *it;
tmp_app_path = (sdDict.has("name")) ? app_path + sdDict["name"].asString() : LLStringUtil::null;
@@ -416,7 +412,6 @@ bool LLSpellChecker::getUseSpellCheck()
return (LLSpellChecker::instanceExists()) && (LLSpellChecker::instance().mHunspell);
}
-// static
bool LLSpellChecker::canRemoveDictionary(const std::string& dict_language)
{
// Only user-installed inactive dictionaries can be removed
@@ -426,7 +421,6 @@ bool LLSpellChecker::canRemoveDictionary(const std::string& dict_language)
( (!getUseSpellCheck()) || (!LLSpellChecker::instance().isActiveDictionary(dict_language)) );
}
-// static
void LLSpellChecker::removeDictionary(const std::string& dict_language)
{
if (!canRemoveDictionary(dict_language))
@@ -499,12 +493,3 @@ void LLSpellChecker::setUseSpellCheck(const std::string& dict_language)
LLSpellChecker::instance().initHunspell(dict_language);
}
}
-
-// static
-void LLSpellChecker::initClass()
-{
- if (sDictMap.isUndefined())
- {
- refreshDictionaryMap();
- }
-}
diff --git a/indra/llui/llspellcheck.h b/indra/llui/llspellcheck.h
index acac589e43..f1964cc091 100644
--- a/indra/llui/llspellcheck.h
+++ b/indra/llui/llspellcheck.h
@@ -34,10 +34,9 @@
class Hunspell;
-class LLSpellChecker : public LLSingleton<LLSpellChecker>, public LLInitClass<LLSpellChecker>
+class LLSpellChecker : public LLSingleton<LLSpellChecker>
{
LLSINGLETON(LLSpellChecker);
- friend class LLInitClass<LLSpellChecker>;
~LLSpellChecker();
public:
@@ -57,26 +56,24 @@ public:
bool isActiveDictionary(const std::string& dict_language) const;
void setSecondaryDictionaries(dict_list_t dict_list);
- static bool canRemoveDictionary(const std::string& dict_language);
+ bool canRemoveDictionary(const std::string& dict_language);
static const std::string getDictionaryAppPath();
static const std::string getDictionaryUserPath();
- static const LLSD getDictionaryData(const std::string& dict_language);
- static const LLSD& getDictionaryMap() { return sDictMap; }
+ const LLSD getDictionaryData(const std::string& dict_language);
+ const LLSD& getDictionaryMap() { return mDictMap; }
static bool getUseSpellCheck();
- static bool hasDictionary(const std::string& dict_language, bool check_installed = false);
- static void refreshDictionaryMap();
- static void removeDictionary(const std::string& dict_language);
+ bool hasDictionary(const std::string& dict_language, bool check_installed = false);
+ void refreshDictionaryMap();
+ void removeDictionary(const std::string& dict_language);
static void setUseSpellCheck(const std::string& dict_language);
protected:
static LLSD loadUserDictionaryMap();
- static void setDictionaryData(const LLSD& dict_info);
+ void setDictionaryData(const LLSD& dict_info);
static void saveUserDictionaryMap(const LLSD& dict_map);
public:
typedef boost::signals2::signal<void()> settings_change_signal_t;
static boost::signals2::connection setSettingsChangeCallback(const settings_change_signal_t::slot_type& cb);
-protected:
- static void initClass();
protected:
Hunspell* mHunspell;
@@ -84,8 +81,8 @@ protected:
std::string mDictFile;
dict_list_t mDictSecondary;
std::vector<std::string> mIgnoreList;
+ LLSD mDictMap;
- static LLSD sDictMap;
static settings_change_signal_t sSettingsChangeSignal;
};
diff --git a/indra/llui/llstatview.cpp b/indra/llui/llstatview.cpp
index eda2d6047f..bb4969c81f 100644
--- a/indra/llui/llstatview.cpp
+++ b/indra/llui/llstatview.cpp
@@ -43,7 +43,7 @@ LLStatView::LLStatView(const LLStatView::Params& p)
BOOL isopen = getDisplayChildren();
if (mSetting.length() > 0)
{
- isopen = LLUI::sSettingGroups["config"]->getBOOL(mSetting);
+ isopen = LLUI::getInstance()->mSettingGroups["config"]->getBOOL(mSetting);
}
setDisplayChildren(isopen);
}
@@ -54,7 +54,7 @@ LLStatView::~LLStatView()
if (mSetting.length() > 0)
{
BOOL isopen = getDisplayChildren();
- LLUI::sSettingGroups["config"]->setBOOL(mSetting, isopen);
+ LLUI::getInstance()->mSettingGroups["config"]->setBOOL(mSetting, isopen);
}
}
diff --git a/indra/llui/lltextbase.cpp b/indra/llui/lltextbase.cpp
index 00443a16b2..e64078828b 100644
--- a/indra/llui/lltextbase.cpp
+++ b/indra/llui/lltextbase.cpp
@@ -3247,7 +3247,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::getWindow()->setCursor(UI_CURSOR_HAND);
+ LLUI::getInstance()->getWindow()->setCursor(UI_CURSOR_HAND);
return TRUE;
}
}
diff --git a/indra/llui/lltextbox.cpp b/indra/llui/lltextbox.cpp
index 9faff1278d..0afd32f332 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::getWindow()->setCursor(UI_CURSOR_HAND);
+ LLUI::getInstance()->getWindow()->setCursor(UI_CURSOR_HAND);
return TRUE;
}
return handled;
diff --git a/indra/llui/lltexteditor.cpp b/indra/llui/lltexteditor.cpp
index 137167db2a..b1f8b00cab 100644
--- a/indra/llui/lltexteditor.cpp
+++ b/indra/llui/lltexteditor.cpp
@@ -1045,7 +1045,7 @@ void LLTextEditor::removeCharOrTab()
}
else
{
- LLUI::reportBadKeystroke();
+ LLUI::getInstance()->reportBadKeystroke();
}
}
@@ -1068,7 +1068,7 @@ void LLTextEditor::removeChar()
}
else
{
- LLUI::reportBadKeystroke();
+ LLUI::getInstance()->reportBadKeystroke();
}
}
@@ -1315,7 +1315,7 @@ BOOL LLTextEditor::handleNavigationKey(const KEY key, const MASK mask)
}
else
{
- LLUI::reportBadKeystroke();
+ LLUI::getInstance()->reportBadKeystroke();
}
}
break;
@@ -1333,7 +1333,7 @@ BOOL LLTextEditor::handleNavigationKey(const KEY key, const MASK mask)
}
else
{
- LLUI::reportBadKeystroke();
+ LLUI::getInstance()->reportBadKeystroke();
}
}
break;
@@ -1665,7 +1665,7 @@ BOOL LLTextEditor::handleSpecialKey(const KEY key, const MASK mask)
}
else
{
- LLUI::reportBadKeystroke();
+ LLUI::getInstance()->reportBadKeystroke();
}
break;
@@ -2750,7 +2750,7 @@ BOOL LLTextEditor::getPreeditLocation(S32 query_offset, LLCoordGL *coord, LLRect
{
LLRect control_rect_screen;
localRectToScreen(mVisibleTextRect, &control_rect_screen);
- LLUI::screenRectToGL(control_rect_screen, control);
+ LLUI::getInstance()->screenRectToGL(control_rect_screen, control);
}
S32 preedit_left_position, preedit_right_position;
@@ -2804,7 +2804,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::screenPointToGL(query_screen_x, query_screen_y, &coord->mX, &coord->mY);
+ LLUI::getInstance()->screenPointToGL(query_screen_x, query_screen_y, &coord->mX, &coord->mY);
}
if (bounds)
@@ -2831,7 +2831,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::screenRectToGL(preedit_rect_screen, bounds);
+ LLUI::getInstance()->screenRectToGL(preedit_rect_screen, bounds);
}
return TRUE;
diff --git a/indra/llui/lltextutil.cpp b/indra/llui/lltextutil.cpp
index f6b2ee1dc0..538508b856 100644
--- a/indra/llui/lltextutil.cpp
+++ b/indra/llui/lltextutil.cpp
@@ -78,7 +78,7 @@ void LLTextUtil::textboxSetGreyedVal(LLTextBox *txtbox, const LLStyle::Params& n
const std::string& LLTextUtil::formatPhoneNumber(const std::string& phone_str)
{
- static const std::string PHONE_SEPARATOR = LLUI::sSettingGroups["config"]->getString("AvalinePhoneSeparator");
+ static const std::string PHONE_SEPARATOR = LLUI::getInstance()->mSettingGroups["config"]->getString("AvalinePhoneSeparator");
static const S32 PHONE_PART_LEN = 2;
static std::string formatted_phone_str;
diff --git a/indra/llui/lltoggleablemenu.cpp b/indra/llui/lltoggleablemenu.cpp
index ccb92ffbb2..3e56e0a589 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::getMousePositionLocal(LLUI::getRootView(), &x, &y);
+ LLUI::getInstance()->getMousePositionLocal(LLUI::getInstance()->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/lltoolbar.cpp b/indra/llui/lltoolbar.cpp
index abc2b6e9ca..e6f466ec78 100644
--- a/indra/llui/lltoolbar.cpp
+++ b/indra/llui/lltoolbar.cpp
@@ -1125,7 +1125,7 @@ BOOL LLToolBarButton::handleHover(S32 x, S32 y, MASK mask)
BOOL handled = FALSE;
S32 mouse_distance_squared = (x - mMouseDownX) * (x - mMouseDownX) + (y - mMouseDownY) * (y - mMouseDownY);
- S32 drag_threshold = LLUI::sSettingGroups["config"]->getS32("DragAndDropDistanceThreshold");
+ S32 drag_threshold = LLUI::getInstance()->mSettingGroups["config"]->getS32("DragAndDropDistanceThreshold");
if (mouse_distance_squared > drag_threshold * drag_threshold
&& hasMouseCapture() &&
mStartDragItemCallback && mHandleDragItemCallback)
diff --git a/indra/llui/lltooltip.cpp b/indra/llui/lltooltip.cpp
index 698b128d45..422534b781 100644
--- a/indra/llui/lltooltip.cpp
+++ b/indra/llui/lltooltip.cpp
@@ -145,10 +145,10 @@ LLToolTip::Params::Params()
wrap("wrap", true),
pos("pos"),
message("message"),
- delay_time("delay_time", LLUI::sSettingGroups["config"]->getF32( "ToolTipDelay" )),
- visible_time_over("visible_time_over", LLUI::sSettingGroups["config"]->getF32( "ToolTipVisibleTimeOver" )),
- visible_time_near("visible_time_near", LLUI::sSettingGroups["config"]->getF32( "ToolTipVisibleTimeNear" )),
- visible_time_far("visible_time_far", LLUI::sSettingGroups["config"]->getF32( "ToolTipVisibleTimeFar" )),
+ delay_time("delay_time", LLUI::getInstance()->mSettingGroups["config"]->getF32( "ToolTipDelay" )),
+ visible_time_over("visible_time_over", LLUI::getInstance()->mSettingGroups["config"]->getF32( "ToolTipVisibleTimeOver" )),
+ visible_time_near("visible_time_near", LLUI::getInstance()->mSettingGroups["config"]->getF32( "ToolTipVisibleTimeNear" )),
+ visible_time_far("visible_time_far", LLUI::getInstance()->mSettingGroups["config"]->getF32( "ToolTipVisibleTimeFar" )),
sticky_rect("sticky_rect"),
image("image"),
text_color("text_color"),
@@ -358,7 +358,7 @@ void LLToolTip::draw()
if (mFadeTimer.getStarted())
{
- F32 tool_tip_fade_time = LLUI::sSettingGroups["config"]->getF32("ToolTipFadeTime");
+ F32 tool_tip_fade_time = LLUI::getInstance()->mSettingGroups["config"]->getF32("ToolTipFadeTime");
alpha = clamp_rescale(mFadeTimer.getElapsedTimeF32(), 0.f, tool_tip_fade_time, 1.f, 0.f);
if (alpha == 0.f)
{
@@ -436,12 +436,12 @@ void LLToolTipMgr::createToolTip(const LLToolTip::Params& params)
{
LLCoordGL pos = params.pos;
// try to spawn at requested position
- LLUI::positionViewNearMouse(mToolTip, pos.mX, pos.mY);
+ LLUI::getInstance()->positionViewNearMouse(mToolTip, pos.mX, pos.mY);
}
else
{
// just spawn at mouse location
- LLUI::positionViewNearMouse(mToolTip);
+ LLUI::getInstance()->positionViewNearMouse(mToolTip);
}
//...update "sticky" rect and tooltip position
@@ -453,7 +453,7 @@ void LLToolTipMgr::createToolTip(const LLToolTip::Params& params)
{
S32 mouse_x;
S32 mouse_y;
- LLUI::getMousePositionLocal(gToolTipView->getParent(), &mouse_x, &mouse_y);
+ LLUI::getInstance()->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);
@@ -491,7 +491,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::getMouseIdleTime() > params_with_defaults.delay_time) // the mouse has been still long enough
+ && LLUI::getInstance()->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()
@@ -563,7 +563,7 @@ void LLToolTipMgr::updateToolTipVisibility()
}
// hide tooltips when mouse cursor is hidden
- if (LLUI::getWindow()->isCursorHidden())
+ if (LLUI::getInstance()->getWindow()->isCursorHidden())
{
blockToolTips();
return;
@@ -574,7 +574,7 @@ void LLToolTipMgr::updateToolTipVisibility()
if (toolTipVisible())
{
S32 mouse_x, mouse_y;
- LLUI::getMousePositionLocal(gToolTipView, &mouse_x, &mouse_y);
+ LLUI::getInstance()->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 52190a1473..656b69d3ed 100644
--- a/indra/llui/llui.cpp
+++ b/indra/llui/llui.cpp
@@ -75,19 +75,6 @@
// Language for UI construction
std::map<std::string, std::string> gTranslation;
std::list<std::string> gUntranslated;
-/*static*/ LLUI::settings_map_t LLUI::sSettingGroups;
-/*static*/ LLUIAudioCallback LLUI::sAudioCallback = NULL;
-/*static*/ LLUIAudioCallback LLUI::sDeferredAudioCallback = NULL;
-/*static*/ LLWindow* LLUI::sWindow = NULL;
-/*static*/ LLView* LLUI::sRootView = NULL;
-/*static*/ BOOL LLUI::sDirty = FALSE;
-/*static*/ LLRect LLUI::sDirtyRect;
-/*static*/ LLHelp* LLUI::sHelpImpl = NULL;
-/*static*/ std::vector<std::string> LLUI::sXUIPaths;
-/*static*/ LLFrameTimer LLUI::sMouseIdleTimer;
-/*static*/ LLUI::add_popup_t LLUI::sAddPopupFunc;
-/*static*/ LLUI::remove_popup_t LLUI::sRemovePopupFunc;
-/*static*/ LLUI::clear_popups_t LLUI::sClearPopupsFunc;
// register filter editor here
static LLDefaultChildRegistry::Register<LLFilterEditor> register_filter_editor("filter_editor");
@@ -106,18 +93,19 @@ LLUUID find_ui_sound(const char * namep)
{
std::string name = ll_safe_string(namep);
LLUUID uuid = LLUUID(NULL);
- if (!LLUI::sSettingGroups["config"]->controlExists(name))
+ LLUI *ui_inst = LLUI::getInstance();
+ if (!ui_inst->mSettingGroups["config"]->controlExists(name))
{
LL_WARNS() << "tried to make UI sound for unknown sound name: " << name << LL_ENDL;
}
else
{
- uuid = LLUUID(LLUI::sSettingGroups["config"]->getString(name));
+ uuid = LLUUID(ui_inst->mSettingGroups["config"]->getString(name));
if (uuid.isNull())
{
- if (LLUI::sSettingGroups["config"]->getString(name) == LLUUID::null.asString())
+ if (ui_inst->mSettingGroups["config"]->getString(name) == LLUUID::null.asString())
{
- if (LLUI::sSettingGroups["config"]->getBOOL("UISndDebugSpamToggle"))
+ if (ui_inst->mSettingGroups["config"]->getBOOL("UISndDebugSpamToggle"))
{
LL_INFOS() << "UI sound name: " << name << " triggered but silent (null uuid)" << LL_ENDL;
}
@@ -127,9 +115,9 @@ LLUUID find_ui_sound(const char * namep)
LL_WARNS() << "UI sound named: " << name << " does not translate to a valid uuid" << LL_ENDL;
}
}
- else if (LLUI::sAudioCallback != NULL)
+ else if (ui_inst->mAudioCallback != NULL)
{
- if (LLUI::sSettingGroups["config"]->getBOOL("UISndDebugSpamToggle"))
+ if (ui_inst->mSettingGroups["config"]->getBOOL("UISndDebugSpamToggle"))
{
LL_INFOS() << "UI sound name: " << name << LL_ENDL;
}
@@ -144,7 +132,7 @@ void make_ui_sound(const char* namep)
LLUUID soundUUID = find_ui_sound(namep);
if(soundUUID.notNull())
{
- LLUI::sAudioCallback(soundUUID);
+ LLUI::getInstance()->mAudioCallback(soundUUID);
}
}
@@ -153,30 +141,31 @@ void make_ui_sound_deferred(const char* namep)
LLUUID soundUUID = find_ui_sound(namep);
if(soundUUID.notNull())
{
- LLUI::sDeferredAudioCallback(soundUUID);
+ LLUI::getInstance()->mDeferredAudioCallback(soundUUID);
}
}
-void LLUI::initClass(const settings_map_t& settings,
- LLImageProviderInterface* image_provider,
- LLUIAudioCallback audio_callback,
- LLUIAudioCallback deferred_audio_callback,
- const LLVector2* scale_factor,
- const std::string& language)
+LLUI::LLUI(const settings_map_t& settings,
+ LLImageProviderInterface* image_provider,
+ LLUIAudioCallback audio_callback,
+ LLUIAudioCallback deferred_audio_callback)
+: mSettingGroups(settings),
+mAudioCallback(audio_callback),
+mDeferredAudioCallback(deferred_audio_callback),
+mWindow(NULL), // set later in startup
+mRootView(NULL),
+mDirty(FALSE),
+mHelpImpl(NULL)
{
- LLRender2D::initClass(image_provider,scale_factor);
- sSettingGroups = settings;
+ LLRender2D::initParamSingleton(image_provider);
- if ((get_ptr_in_map(sSettingGroups, std::string("config")) == NULL) ||
- (get_ptr_in_map(sSettingGroups, std::string("floater")) == NULL) ||
- (get_ptr_in_map(sSettingGroups, std::string("ignores")) == NULL))
+ if ((get_ptr_in_map(mSettingGroups, std::string("config")) == NULL) ||
+ (get_ptr_in_map(mSettingGroups, std::string("floater")) == NULL) ||
+ (get_ptr_in_map(mSettingGroups, std::string("ignores")) == NULL))
{
LL_ERRS() << "Failure to initialize configuration groups" << LL_ENDL;
}
- sAudioCallback = audio_callback;
- sDeferredAudioCallback = deferred_audio_callback;
- sWindow = NULL; // set later in startup
LLFontGL::sShadowColor = LLUIColorTable::instance().getColor("ColorDropShadow");
LLUICtrl::CommitCallbackRegistry::Registrar& reg = LLUICtrl::CommitCallbackRegistry::defaultRegistrar();
@@ -207,33 +196,26 @@ void LLUI::initClass(const settings_map_t& settings,
LLCommandManager::load();
}
-void LLUI::cleanupClass()
-{
- SUBSYSTEM_CLEANUP(LLRender2D);
-}
-
void LLUI::setPopupFuncs(const add_popup_t& add_popup, const remove_popup_t& remove_popup, const clear_popups_t& clear_popups)
{
- sAddPopupFunc = add_popup;
- sRemovePopupFunc = remove_popup;
- sClearPopupsFunc = clear_popups;
+ mAddPopupFunc = add_popup;
+ mRemovePopupFunc = remove_popup;
+ mClearPopupsFunc = clear_popups;
}
-//static
void LLUI::dirtyRect(LLRect rect)
{
- if (!sDirty)
+ if (!mDirty)
{
- sDirtyRect = rect;
- sDirty = TRUE;
+ mDirtyRect = rect;
+ mDirty = TRUE;
}
else
{
- sDirtyRect.unionWith(rect);
- }
+ mDirtyRect.unionWith(rect);
+ }
}
-
-//static
+
void LLUI::setMousePositionScreen(S32 x, S32 y)
{
#if defined(LL_DARWIN)
@@ -247,7 +229,6 @@ void LLUI::setMousePositionScreen(S32 x, S32 y)
LLView::getWindow()->setCursorPosition(LLCoordGL(screen_x, screen_y).convert());
}
-//static
void LLUI::getMousePositionScreen(S32 *x, S32 *y)
{
LLCoordWindow cursor_pos_window;
@@ -257,7 +238,6 @@ 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;
@@ -266,7 +246,6 @@ 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;
@@ -280,20 +259,19 @@ void LLUI::getMousePositionLocal(const LLView* viewp, S32 *x, S32 *y)
// or on Windows if the SecondLife.exe executable is run directly, the
// language follows the OS language. In all cases the user can override
// the language manually in preferences. JC
-// static
-std::string LLUI::getLanguage()
+std::string LLUI::getUILanguage()
{
std::string language = "en";
- if (sSettingGroups["config"])
+ if (mSettingGroups["config"])
{
- language = sSettingGroups["config"]->getString("Language");
+ language = mSettingGroups["config"]->getString("Language");
if (language.empty() || language == "default")
{
- language = sSettingGroups["config"]->getString("InstallLanguage");
+ language = mSettingGroups["config"]->getString("InstallLanguage");
}
if (language.empty() || language == "default")
{
- language = sSettingGroups["config"]->getString("SystemLanguage");
+ language = mSettingGroups["config"]->getString("SystemLanguage");
}
if (language.empty() || language == "default")
{
@@ -303,6 +281,13 @@ std::string LLUI::getLanguage()
return language;
}
+// static
+std::string LLUI::getLanguage()
+{
+ // Note: lldateutil_test redefines this function
+ return LLUI::getInstance()->getUILanguage();
+}
+
struct SubDir : public LLInitParam::Block<SubDir>
{
Mandatory<std::string> value;
@@ -362,37 +347,32 @@ std::string LLUI::locateSkin(const std::string& filename)
return "";
}
-//static
LLVector2 LLUI::getWindowSize()
{
LLCoordWindow window_rect;
- sWindow->getSize(&window_rect);
+ mWindow->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);
@@ -402,8 +382,8 @@ void LLUI::glRectToScreen(const LLRect& gl, LLRect *screen)
LLControlGroup& LLUI::getControlControlGroup (const std::string& controlname)
{
- for (settings_map_t::iterator itor = sSettingGroups.begin();
- itor != sSettingGroups.end(); ++itor)
+ for (settings_map_t::iterator itor = mSettingGroups.begin();
+ itor != mSettingGroups.end(); ++itor)
{
LLControlGroup* control_group = itor->second;
if(control_group != NULL)
@@ -413,43 +393,38 @@ LLControlGroup& LLUI::getControlControlGroup (const std::string& controlname)
}
}
- return *sSettingGroups["config"]; // default group
+ return *mSettingGroups["config"]; // default group
}
-//static
void LLUI::addPopup(LLView* viewp)
{
- if (sAddPopupFunc)
+ if (mAddPopupFunc)
{
- sAddPopupFunc(viewp);
+ mAddPopupFunc(viewp);
}
}
-//static
void LLUI::removePopup(LLView* viewp)
{
- if (sRemovePopupFunc)
+ if (mRemovePopupFunc)
{
- sRemovePopupFunc(viewp);
+ mRemovePopupFunc(viewp);
}
}
-//static
void LLUI::clearPopups()
{
- if (sClearPopupsFunc)
+ if (mClearPopupsFunc)
{
- sClearPopupsFunc();
+ mClearPopupsFunc();
}
}
-//static
void LLUI::reportBadKeystroke()
{
make_ui_sound("UISndBadKeystroke");
}
-
-//static
+
// spawn_x and spawn_y are top left corner of view in screen GL coordinates
void LLUI::positionViewNearMouse(LLView* view, S32 spawn_x, S32 spawn_y)
{
@@ -460,7 +435,7 @@ void LLUI::positionViewNearMouse(LLView* view, S32 spawn_x, S32 spawn_y)
S32 mouse_x;
S32 mouse_y;
- LLUI::getMousePositionScreen(&mouse_x, &mouse_y);
+ getMousePositionScreen(&mouse_x, &mouse_y);
// If no spawn location provided, use mouse position
if (spawn_x == S32_MAX || spawn_y == S32_MAX)
diff --git a/indra/llui/llui.h b/indra/llui/llui.h
index d7151dbee9..e1c51deba9 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:
+ LLSINGLETON(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)
{}
};
diff --git a/indra/llui/llurlentry.cpp b/indra/llui/llurlentry.cpp
index 0dbd7ceb25..333d03f208 100644
--- a/indra/llui/llurlentry.cpp
+++ b/indra/llui/llurlentry.cpp
@@ -176,7 +176,7 @@ void LLUrlEntryBase::callObservers(const std::string &id,
bool LLUrlEntryBase::isLinkDisabled() const
{
// this allows us to have a global setting to turn off text hyperlink highlighting/action
- bool globally_disabled = LLUI::sSettingGroups["config"]->getBOOL("DisableTextHyperlinkActions");
+ bool globally_disabled = LLUI::getInstance()->mSettingGroups["config"]->getBOOL("DisableTextHyperlinkActions");
return globally_disabled;
}
diff --git a/indra/llui/llview.cpp b/indra/llui/llview.cpp
index b0e346f513..593c8b12fc 100644
--- a/indra/llui/llview.cpp
+++ b/indra/llui/llview.cpp
@@ -816,7 +816,7 @@ LLView* LLView::childrenHandleHover(S32 x, S32 y, MASK mask)
}
// This call differentiates this method from childrenHandleMouseEvent().
- LLUI::sWindow->setCursor(viewp->getHoverCursor());
+ LLUI::getInstance()->mWindow->setCursor(viewp->getHoverCursor());
if (viewp->handleHover(local_x, local_y, mask)
|| viewp->blockMouseEvent(local_x, local_y))
@@ -873,11 +873,11 @@ BOOL LLView::handleToolTip(S32 x, S32 y, MASK mask)
// allow "scrubbing" over ui by showing next tooltip immediately
// if previous one was still visible
F32 timeout = LLToolTipMgr::instance().toolTipVisible()
- ? LLUI::sSettingGroups["config"]->getF32( "ToolTipFastDelay" )
- : LLUI::sSettingGroups["config"]->getF32( "ToolTipDelay" );
+ ? LLUI::getInstance()->mSettingGroups["config"]->getF32( "ToolTipFastDelay" )
+ : LLUI::getInstance()->mSettingGroups["config"]->getF32( "ToolTipDelay" );
// Even if we don't show tooltips, consume the event, nothing below should show tooltip
- bool allow_ui_tooltips = LLUI::sSettingGroups["config"]->getBOOL( "BasicUITooltips" );
+ bool allow_ui_tooltips = LLUI::getInstance()->mSettingGroups["config"]->getBOOL("BasicUITooltips");
if (allow_ui_tooltips)
{
LLToolTipMgr::instance().show(LLToolTip::Params()
@@ -1158,7 +1158,7 @@ void LLView::drawChildren()
{
if (!mChildList.empty())
{
- LLView* rootp = LLUI::getRootView();
+ LLView* rootp = LLUI::getInstance()->getRootView();
++sDepth;
for (child_list_reverse_iter_t child_iter = mChildList.rbegin(); child_iter != mChildList.rend();) // ++child_iter)
@@ -1174,7 +1174,7 @@ void LLView::drawChildren()
if (viewp->getVisible() && viewp->getRect().isValid())
{
LLRect screen_rect = viewp->calcScreenRect();
- if ( rootp->getLocalRect().overlaps(screen_rect) && LLUI::sDirtyRect.overlaps(screen_rect))
+ if ( rootp->getLocalRect().overlaps(screen_rect) && LLUI::getInstance()->mDirtyRect.overlaps(screen_rect))
{
LLUI::pushMatrix();
{
@@ -1216,7 +1216,7 @@ void LLView::dirtyRect()
parent = parent->getParent();
}
- LLUI::dirtyRect(cur->calcScreenRect());
+ LLUI::getInstance()->dirtyRect(cur->calcScreenRect());
}
//Draw a box for debugging.
@@ -2239,9 +2239,9 @@ LLControlVariable *LLView::findControl(const std::string& name)
std::string control_group_key = name.substr(0, key_pos);
LLControlVariable* control;
// check if it's in the control group that name indicated
- if(LLUI::sSettingGroups[control_group_key])
+ if(LLUI::getInstance()->mSettingGroups[control_group_key])
{
- control = LLUI::sSettingGroups[control_group_key]->getControl(name);
+ control = LLUI::getInstance()->mSettingGroups[control_group_key]->getControl(name);
if (control)
{
return control;
@@ -2249,7 +2249,7 @@ LLControlVariable *LLView::findControl(const std::string& name)
}
}
- LLControlGroup& control_group = LLUI::getControlControlGroup(name);
+ LLControlGroup& control_group = LLUI::getInstance()->getControlControlGroup(name);
return control_group.getControl(name);
}
diff --git a/indra/llui/llview.h b/indra/llui/llview.h
index b448cc8397..db81900aaf 100644
--- a/indra/llui/llview.h
+++ b/indra/llui/llview.h
@@ -499,7 +499,7 @@ public:
// return query for iterating over focus roots in tab order
static const LLViewQuery & getFocusRootsQuery();
- static LLWindow* getWindow(void) { return LLUI::sWindow; }
+ static LLWindow* getWindow(void) { return LLUI::getInstance()->mWindow; }
// 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 8754cfebbb..cb000aef74 100644
--- a/indra/llui/llviewereventrecorder.cpp
+++ b/indra/llui/llviewereventrecorder.cpp
@@ -44,7 +44,7 @@ LLViewerEventRecorder::LLViewerEventRecorder() {
bool LLViewerEventRecorder::displayViewerEventRecorderMenuItems() {
- return LLUI::sSettingGroups["config"]->getBOOL("ShowEventRecorderMenuItems");
+ return LLUI::getInstance()->mSettingGroups["config"]->getBOOL("ShowEventRecorderMenuItems");
}
@@ -99,7 +99,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) {
- LLView * target_view = LLUI::resolvePath(LLUI::getRootView(), xui);
+ LLView * target_view = LLUI::getInstance()->resolvePath(LLUI::getInstance()->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;
@@ -216,7 +216,7 @@ void LLViewerEventRecorder::playbackRecording() {
LLSD LeapCommand;
// ivita sets this on startup, it also sends commands to the viewer to make start, stop, and playback menu items visible in viewer
- LeapCommand =LLUI::sSettingGroups["config"]->getLLSD("LeapPlaybackEventsCommand");
+ LeapCommand =LLUI::getInstance()->mSettingGroups["config"]->getLLSD("LeapPlaybackEventsCommand");
LL_DEBUGS() << "[VITA] launching playback - leap command is: " << LLSDXMLStreamer(LeapCommand) << LL_ENDL;
LLLeap::create("", LeapCommand, false); // exception=false
diff --git a/indra/llui/llviewinject.h b/indra/llui/llviewinject.h
index 0de3d155c4..7f18ec6fbe 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::resolvePath() to obtain an LLView* given a string pathname.)
+ * LLUI::getInstance()->resolvePath() to obtain an LLView* given a string pathname.)
* This sets up for operator().
*/
TargetEvent(LLView* view);