summaryrefslogtreecommitdiff
path: root/indra/llui
diff options
context:
space:
mode:
authorErik Kundiman <erik@megapahit.org>2024-08-31 21:25:47 +0800
committerErik Kundiman <erik@megapahit.org>2024-09-01 20:43:42 +0800
commit95582654e49422d51b55665c3f2821c848ad1cb8 (patch)
treed6d03a887b8e1b6c3be1b139d63b1638c5d0fdcd /indra/llui
parentab3f483a3e5ed213882a83b882095cfdb6a4de57 (diff)
parentb0fefd62adbf51f32434ba077e9f52d8a9241d15 (diff)
Merge remote-tracking branch 'secondlife/release/2024.08-DeltaFPS' into 2024.08-DeltaFPS
Diffstat (limited to 'indra/llui')
-rw-r--r--indra/llui/llaccordionctrl.cpp123
-rw-r--r--indra/llui/llaccordionctrl.h26
-rw-r--r--indra/llui/llaccordionctrltab.cpp6
-rw-r--r--indra/llui/llbadge.cpp20
-rw-r--r--indra/llui/llbadge.h2
-rw-r--r--indra/llui/llbutton.cpp20
-rw-r--r--indra/llui/llbutton.h18
-rw-r--r--indra/llui/llcheckboxctrl.cpp6
-rw-r--r--indra/llui/llcheckboxctrl.h6
-rw-r--r--indra/llui/llcombobox.cpp14
-rw-r--r--indra/llui/llcombobox.h1
-rw-r--r--indra/llui/llconsole.cpp7
-rw-r--r--indra/llui/llcontainerview.cpp8
-rw-r--r--indra/llui/llcontainerview.h2
-rw-r--r--indra/llui/lldockcontrol.cpp7
-rw-r--r--indra/llui/lldockcontrol.h1
-rw-r--r--indra/llui/llemojihelper.cpp4
-rw-r--r--indra/llui/llf32uictrl.cpp4
-rw-r--r--indra/llui/llflatlistview.cpp49
-rw-r--r--indra/llui/llfloater.cpp86
-rw-r--r--indra/llui/llfloaterreg.cpp165
-rw-r--r--indra/llui/llfloaterreg.h36
-rw-r--r--indra/llui/llfloaterreglistener.cpp12
-rw-r--r--indra/llui/llfocusmgr.cpp22
-rw-r--r--indra/llui/llfolderview.cpp2
-rw-r--r--indra/llui/llfolderviewitem.cpp46
-rw-r--r--indra/llui/llfolderviewitem.h6
-rw-r--r--indra/llui/lliconctrl.h2
-rw-r--r--indra/llui/llkeywords.cpp36
-rw-r--r--indra/llui/llkeywords.h22
-rw-r--r--indra/llui/lllayoutstack.cpp61
-rw-r--r--indra/llui/lllayoutstack.h2
-rw-r--r--indra/llui/lllineeditor.cpp6
-rw-r--r--indra/llui/lllineeditor.h12
-rw-r--r--indra/llui/llmenugl.cpp20
-rw-r--r--indra/llui/llmenugl.h10
-rw-r--r--indra/llui/llmultisliderctrl.cpp6
-rw-r--r--indra/llui/llmultisliderctrl.h4
-rw-r--r--indra/llui/llnotifications.cpp33
-rw-r--r--indra/llui/llnotifications.h27
-rw-r--r--indra/llui/llnotificationslistener.cpp2
-rw-r--r--indra/llui/llpanel.cpp48
-rw-r--r--indra/llui/llpanel.h58
-rw-r--r--indra/llui/llscrollbar.cpp24
-rw-r--r--indra/llui/llscrollbar.h3
-rw-r--r--indra/llui/llscrollingpanellist.cpp44
-rw-r--r--indra/llui/llscrolllistcell.cpp32
-rw-r--r--indra/llui/llscrolllistctrl.cpp72
-rw-r--r--indra/llui/llscrolllistctrl.h2
-rw-r--r--indra/llui/llsearchablecontrol.h2
-rw-r--r--indra/llui/llsliderctrl.cpp6
-rw-r--r--indra/llui/llsliderctrl.h4
-rw-r--r--indra/llui/llspellcheck.cpp45
-rw-r--r--indra/llui/llspellcheck.h9
-rw-r--r--indra/llui/llspinctrl.cpp2
-rw-r--r--indra/llui/llspinctrl.h4
-rw-r--r--indra/llui/llstatbar.cpp56
-rw-r--r--indra/llui/llstatgraph.cpp13
-rw-r--r--indra/llui/llstyle.cpp6
-rw-r--r--indra/llui/llstyle.h18
-rw-r--r--indra/llui/lltabcontainer.cpp12
-rw-r--r--indra/llui/lltabcontainer.h10
-rw-r--r--indra/llui/lltextbase.cpp81
-rw-r--r--indra/llui/lltextbase.h16
-rw-r--r--indra/llui/lltextbox.cpp2
-rw-r--r--indra/llui/lltextbox.h2
-rw-r--r--indra/llui/lltexteditor.cpp10
-rw-r--r--indra/llui/lltexteditor.h2
-rw-r--r--indra/llui/lltextparser.cpp78
-rw-r--r--indra/llui/lltextparser.h5
-rw-r--r--indra/llui/lltoolbar.cpp2
-rw-r--r--indra/llui/lltrans.cpp24
-rw-r--r--indra/llui/lltrans.h23
-rw-r--r--indra/llui/llui.cpp28
-rw-r--r--indra/llui/llui.h14
-rw-r--r--indra/llui/lluicolortable.cpp78
-rw-r--r--indra/llui/lluicolortable.h17
-rw-r--r--indra/llui/lluictrl.cpp12
-rw-r--r--indra/llui/lluictrl.h4
-rw-r--r--indra/llui/lluictrlfactory.h4
-rw-r--r--indra/llui/llurlentry.cpp2
-rw-r--r--indra/llui/llurlregistry.cpp2
-rw-r--r--indra/llui/llview.cpp26
-rw-r--r--indra/llui/llview.h24
-rw-r--r--indra/llui/llviewborder.cpp6
-rw-r--r--indra/llui/llviewborder.h6
-rw-r--r--indra/llui/llviewereventrecorder.cpp4
-rw-r--r--indra/llui/llvirtualtrackball.cpp30
-rw-r--r--indra/llui/llwindowshade.cpp46
-rw-r--r--indra/llui/llwindowshade.h7
-rw-r--r--indra/llui/llxyvector.cpp22
91 files changed, 1047 insertions, 942 deletions
diff --git a/indra/llui/llaccordionctrl.cpp b/indra/llui/llaccordionctrl.cpp
index 4682044d6e..495ba2f40f 100644
--- a/indra/llui/llaccordionctrl.cpp
+++ b/indra/llui/llaccordionctrl.cpp
@@ -36,12 +36,12 @@
#include "boost/bind.hpp"
-static const S32 BORDER_MARGIN = 2;
-static const S32 PARENT_BORDER_MARGIN = 5;
-static const S32 VERTICAL_MULTIPLE = 16;
-static const F32 MIN_AUTO_SCROLL_RATE = 120.f;
-static const F32 MAX_AUTO_SCROLL_RATE = 500.f;
-static const F32 AUTO_SCROLL_RATE_ACCEL = 120.f;
+static constexpr S32 BORDER_MARGIN = 2;
+static constexpr S32 PARENT_BORDER_MARGIN = 5;
+static constexpr S32 VERTICAL_MULTIPLE = 16;
+static constexpr F32 MIN_AUTO_SCROLL_RATE = 120.f;
+static constexpr F32 MAX_AUTO_SCROLL_RATE = 500.f;
+static constexpr F32 AUTO_SCROLL_RATE_ACCEL = 120.f;
// LLAccordionCtrl =================================================================|
@@ -49,13 +49,7 @@ static LLDefaultChildRegistry::Register<LLAccordionCtrl> t2("accordion");
LLAccordionCtrl::LLAccordionCtrl(const Params& params):LLPanel(params)
, mFitParent(params.fit_parent)
- , mAutoScrolling( false )
- , mAutoScrollRate( 0.f )
- , mSelectedTab( NULL )
- , mTabComparator( NULL )
- , mNoVisibleTabsHelpText(NULL)
, mNoVisibleTabsOrigString(params.no_visible_tabs_text.initial_value().asString())
- , mSkipScrollToChild(false)
{
initNoTabsWidget(params.no_matched_tabs_text);
@@ -67,10 +61,6 @@ LLAccordionCtrl::LLAccordionCtrl(const Params& params):LLPanel(params)
}
LLAccordionCtrl::LLAccordionCtrl() : LLPanel()
- , mAutoScrolling( false )
- , mAutoScrollRate( 0.f )
- , mSelectedTab( NULL )
- , mNoVisibleTabsHelpText(NULL)
{
initNoTabsWidget(LLTextBox::Params());
@@ -133,11 +123,10 @@ bool LLAccordionCtrl::postBuild()
mScrollbar->setFollowsBottom();
//if it was created from xml...
- std::vector<LLUICtrl*> accordion_tabs;
- for (child_list_const_iter_t it = getChildList()->begin();
- getChildList()->end() != it; ++it)
+ std::vector<LLAccordionCtrlTab*> accordion_tabs;
+ for(LLView* viewp : *getChildList())
{
- LLAccordionCtrlTab* accordion_tab = dynamic_cast<LLAccordionCtrlTab*>(*it);
+ LLAccordionCtrlTab* accordion_tab = dynamic_cast<LLAccordionCtrlTab*>(viewp);
if (accordion_tab == NULL)
continue;
if (std::find(mAccordionTabs.begin(), mAccordionTabs.end(), accordion_tab) == mAccordionTabs.end())
@@ -146,7 +135,7 @@ bool LLAccordionCtrl::postBuild()
}
}
- for (std::vector<LLUICtrl*>::reverse_iterator it = accordion_tabs.rbegin();
+ for (auto it = accordion_tabs.rbegin();
it < accordion_tabs.rend(); ++it)
{
addCollapsibleCtrl(*it);
@@ -294,11 +283,8 @@ void LLAccordionCtrl::hideScrollbar(S32 width, S32 height)
S32 LLAccordionCtrl::calcRecuiredHeight()
{
S32 rec_height = 0;
-
- std::vector<LLAccordionCtrlTab*>::iterator panel;
- for(panel=mAccordionTabs.begin(); panel!=mAccordionTabs.end(); ++panel)
+ for(LLAccordionCtrlTab* accordion_tab : mAccordionTabs)
{
- LLAccordionCtrlTab* accordion_tab = dynamic_cast<LLAccordionCtrlTab*>(*panel);
if(accordion_tab && accordion_tab->getVisible())
{
rec_height += accordion_tab->getRect().getHeight();
@@ -330,9 +316,8 @@ void LLAccordionCtrl::ctrlShiftVertical(LLView* panel, S32 delta)
//---------------------------------------------------------------------------------
-void LLAccordionCtrl::addCollapsibleCtrl(LLView* view)
+void LLAccordionCtrl::addCollapsibleCtrl(LLAccordionCtrlTab* accordion_tab)
{
- LLAccordionCtrlTab* accordion_tab = dynamic_cast<LLAccordionCtrlTab*>(view);
if (!accordion_tab)
return;
if (std::find(beginChild(), endChild(), accordion_tab) == endChild())
@@ -343,9 +328,8 @@ void LLAccordionCtrl::addCollapsibleCtrl(LLView* view)
arrange();
}
-void LLAccordionCtrl::removeCollapsibleCtrl(LLView* view)
+void LLAccordionCtrl::removeCollapsibleCtrl(LLAccordionCtrlTab* accordion_tab)
{
- LLAccordionCtrlTab* accordion_tab = dynamic_cast<LLAccordionCtrlTab*>(view);
if(!accordion_tab)
return;
@@ -363,7 +347,7 @@ void LLAccordionCtrl::removeCollapsibleCtrl(LLView* view)
}
// if removed is selected - reset selection
- if (mSelectedTab == view)
+ if (mSelectedTab == accordion_tab)
{
mSelectedTab = NULL;
}
@@ -379,12 +363,10 @@ void LLAccordionCtrl::initNoTabsWidget(const LLTextBox::Params& tb_params)
void LLAccordionCtrl::updateNoTabsHelpTextVisibility()
{
- bool visible_exists = false;
- std::vector<LLAccordionCtrlTab*>::const_iterator it = mAccordionTabs.begin();
- const std::vector<LLAccordionCtrlTab*>::const_iterator it_end = mAccordionTabs.end();
- while (it < it_end)
+ bool visible_exists{ false };
+ for (auto accordion_tab : mAccordionTabs)
{
- if ((*(it++))->getVisible())
+ if (accordion_tab->getVisible())
{
visible_exists = true;
break;
@@ -403,24 +385,20 @@ void LLAccordionCtrl::arrangeSingle()
S32 collapsed_height = 0;
- for (size_t i = 0; i < mAccordionTabs.size(); ++i)
+ for (LLAccordionCtrlTab* accordion_tab : mAccordionTabs)
{
- LLAccordionCtrlTab* accordion_tab = dynamic_cast<LLAccordionCtrlTab*>(mAccordionTabs[i]);
-
if (!accordion_tab->getVisible()) // Skip hidden accordion tabs
continue;
if (!accordion_tab->isExpanded() )
{
- collapsed_height+=mAccordionTabs[i]->getRect().getHeight();
+ collapsed_height += accordion_tab->getRect().getHeight();
}
}
S32 expanded_height = getRect().getHeight() - BORDER_MARGIN - collapsed_height;
- for (size_t i = 0; i < mAccordionTabs.size(); ++i)
+ for (LLAccordionCtrlTab* accordion_tab : mAccordionTabs)
{
- LLAccordionCtrlTab* accordion_tab = dynamic_cast<LLAccordionCtrlTab*>(mAccordionTabs[i]);
-
if (!accordion_tab->getVisible()) // Skip hidden accordion tabs
continue;
if (!accordion_tab->isExpanded() )
@@ -450,8 +428,8 @@ void LLAccordionCtrl::arrangeSingle()
// make sure at least header is shown
panel_height = llmax(panel_height, accordion_tab->getHeaderHeight());
- ctrlSetLeftTopAndSize(mAccordionTabs[i], panel_left, panel_top, panel_width, panel_height);
- panel_top -= mAccordionTabs[i]->getRect().getHeight();
+ ctrlSetLeftTopAndSize(accordion_tab, panel_left, panel_top, panel_width, panel_height);
+ panel_top -= accordion_tab->getRect().getHeight();
}
show_hide_scrollbar(getRect().getWidth(), getRect().getHeight());
@@ -465,17 +443,16 @@ void LLAccordionCtrl::arrangeMultiple()
S32 panel_width = getRect().getWidth() - 4;
//Calculate params
- for (size_t i = 0; i < mAccordionTabs.size(); i++ )
+ for (size_t i = 0, end = mAccordionTabs.size(); i < end; i++)
{
- LLAccordionCtrlTab* accordion_tab = dynamic_cast<LLAccordionCtrlTab*>(mAccordionTabs[i]);
-
+ LLAccordionCtrlTab* accordion_tab = static_cast<LLAccordionCtrlTab*>(mAccordionTabs[i]);
if (!accordion_tab->getVisible()) // Skip hidden accordion tabs
continue;
if (!accordion_tab->isExpanded() )
{
- ctrlSetLeftTopAndSize(mAccordionTabs[i], panel_left, panel_top, panel_width, accordion_tab->getRect().getHeight());
- panel_top -= mAccordionTabs[i]->getRect().getHeight();
+ ctrlSetLeftTopAndSize(accordion_tab, panel_left, panel_top, panel_width, accordion_tab->getRect().getHeight());
+ panel_top -= accordion_tab->getRect().getHeight();
}
else
{
@@ -497,13 +474,13 @@ void LLAccordionCtrl::arrangeMultiple()
}
// minimum tab height is equal to header height
- if (mAccordionTabs[i]->getHeaderHeight() > panel_height)
+ if (accordion_tab->getHeaderHeight() > panel_height)
{
- panel_height = mAccordionTabs[i]->getHeaderHeight();
+ panel_height = accordion_tab->getHeaderHeight();
}
}
- ctrlSetLeftTopAndSize(mAccordionTabs[i], panel_left, panel_top, panel_width, panel_height);
+ ctrlSetLeftTopAndSize(accordion_tab, panel_left, panel_top, panel_width, panel_height);
panel_top -= panel_height;
}
@@ -530,7 +507,7 @@ void LLAccordionCtrl::arrange()
S32 panel_top = getRect().getHeight() - BORDER_MARGIN; // Top coordinate of the first panel
S32 panel_width = getRect().getWidth() - 4;
- LLAccordionCtrlTab* accordion_tab = dynamic_cast<LLAccordionCtrlTab*>(mAccordionTabs[0]);
+ LLAccordionCtrlTab* accordion_tab = mAccordionTabs[0];
LLRect panel_rect = accordion_tab->getRect();
@@ -640,12 +617,12 @@ void LLAccordionCtrl::updateLayout(S32 width, S32 height)
panel_width -= scrollbar_size;
// set sizes for first panels and dragbars
- for (size_t i = 0; i < mAccordionTabs.size(); ++i)
+ for (LLAccordionCtrlTab* accordion_tab : mAccordionTabs)
{
- if (!mAccordionTabs[i]->getVisible())
+ if (!accordion_tab->getVisible())
continue;
- LLRect panel_rect = mAccordionTabs[i]->getRect();
- ctrlSetLeftTopAndSize(mAccordionTabs[i], panel_rect.mLeft, panel_top, panel_width, panel_rect.getHeight());
+ LLRect panel_rect = accordion_tab->getRect();
+ ctrlSetLeftTopAndSize(accordion_tab, panel_rect.mLeft, panel_top, panel_width, panel_rect.getHeight());
panel_top -= panel_rect.getHeight();
}
}
@@ -687,9 +664,8 @@ void LLAccordionCtrl::onUpdateScrollToChild(const LLUICtrl *cntrl)
void LLAccordionCtrl::onOpen(const LLSD& key)
{
- for (size_t i = 0; i < mAccordionTabs.size(); ++i)
+ for (LLAccordionCtrlTab* accordion_tab : mAccordionTabs)
{
- LLAccordionCtrlTab* accordion_tab = dynamic_cast<LLAccordionCtrlTab*>(mAccordionTabs[i]);
LLPanel* panel = dynamic_cast<LLPanel*>(accordion_tab->getAccordionView());
if (panel != NULL)
{
@@ -713,7 +689,7 @@ S32 LLAccordionCtrl::notifyParent(const LLSD& info)
{
for (size_t i = 0; i < mAccordionTabs.size(); ++i)
{
- LLAccordionCtrlTab* accordion_tab = dynamic_cast<LLAccordionCtrlTab*>(mAccordionTabs[i]);
+ LLAccordionCtrlTab* accordion_tab = static_cast<LLAccordionCtrlTab*>(mAccordionTabs[i]);
if (accordion_tab->hasFocus())
{
while (++i < mAccordionTabs.size())
@@ -723,7 +699,7 @@ S32 LLAccordionCtrl::notifyParent(const LLSD& info)
}
if (i < mAccordionTabs.size())
{
- accordion_tab = dynamic_cast<LLAccordionCtrlTab*>(mAccordionTabs[i]);
+ accordion_tab = static_cast<LLAccordionCtrlTab*>(mAccordionTabs[i]);
accordion_tab->notify(LLSD().with("action","select_first"));
return 1;
}
@@ -736,7 +712,7 @@ S32 LLAccordionCtrl::notifyParent(const LLSD& info)
{
for (size_t i = 0; i < mAccordionTabs.size(); ++i)
{
- LLAccordionCtrlTab* accordion_tab = dynamic_cast<LLAccordionCtrlTab*>(mAccordionTabs[i]);
+ LLAccordionCtrlTab* accordion_tab = static_cast<LLAccordionCtrlTab*>(mAccordionTabs[i]);
if (accordion_tab->hasFocus() && i > 0)
{
bool prev_visible_tab_found = false;
@@ -751,7 +727,7 @@ S32 LLAccordionCtrl::notifyParent(const LLSD& info)
if (prev_visible_tab_found)
{
- accordion_tab = dynamic_cast<LLAccordionCtrlTab*>(mAccordionTabs[i]);
+ accordion_tab = static_cast<LLAccordionCtrlTab*>(mAccordionTabs[i]);
accordion_tab->notify(LLSD().with("action","select_last"));
return 1;
}
@@ -889,15 +865,12 @@ void LLAccordionCtrl::setFilterSubString(const std::string& filter_string)
const LLAccordionCtrlTab* LLAccordionCtrl::getExpandedTab() const
{
- typedef std::vector<LLAccordionCtrlTab*>::const_iterator tabs_const_iterator;
-
- const LLAccordionCtrlTab* result = 0;
-
- for (tabs_const_iterator i = mAccordionTabs.begin(); i != mAccordionTabs.end(); ++i)
+ const LLAccordionCtrlTab* result = nullptr;
+ for (LLAccordionCtrlTab* accordion_tab : mAccordionTabs)
{
- if ((*i)->isExpanded())
+ if (accordion_tab->isExpanded())
{
- result = *i;
+ result = accordion_tab;
break;
}
}
@@ -915,11 +888,11 @@ S32 LLAccordionCtrl::calcExpandedTabHeight(S32 tab_index /* = 0 */, S32 availabl
S32 collapsed_tabs_height = 0;
S32 num_expanded = 0;
- for (size_t n = tab_index; n < mAccordionTabs.size(); ++n)
+ for (LLAccordionCtrlTab* tab : mAccordionTabs)
{
- if (!mAccordionTabs[n]->isExpanded())
+ if (!tab->isExpanded())
{
- collapsed_tabs_height += mAccordionTabs[n]->getHeaderHeight();
+ collapsed_tabs_height += tab->getHeaderHeight();
}
else
{
@@ -941,10 +914,8 @@ void LLAccordionCtrl::collapseAllTabs()
{
if (mAccordionTabs.size() > 0)
{
- for (size_t i = 0; i < mAccordionTabs.size(); ++i)
+ for (LLAccordionCtrlTab* tab : mAccordionTabs)
{
- LLAccordionCtrlTab *tab = mAccordionTabs[i];
-
if (tab->getDisplayChildren())
{
tab->setDisplayChildren(false);
diff --git a/indra/llui/llaccordionctrl.h b/indra/llui/llaccordionctrl.h
index 1dfa9100f6..43a33a2b3c 100644
--- a/indra/llui/llaccordionctrl.h
+++ b/indra/llui/llaccordionctrl.h
@@ -57,8 +57,8 @@ public:
class LLTabComparator
{
public:
- LLTabComparator() {};
- virtual ~LLTabComparator() {};
+ LLTabComparator() = default;
+ virtual ~LLTabComparator() = default;
/** Returns true if tab1 < tab2, false otherwise */
virtual bool compare(const LLAccordionCtrlTab* tab1, const LLAccordionCtrlTab* tab2) const = 0;
@@ -103,8 +103,8 @@ public:
// Call reshape after changing splitter's size
virtual void reshape(S32 width, S32 height, bool called_from_parent = true);
- void addCollapsibleCtrl(LLView* view);
- void removeCollapsibleCtrl(LLView* view);
+ void addCollapsibleCtrl(LLAccordionCtrlTab* accordion_tab);
+ void removeCollapsibleCtrl(LLAccordionCtrlTab* accordion_tab);
void arrange();
@@ -180,20 +180,20 @@ private:
private:
LLRect mInnerRect;
- LLScrollbar* mScrollbar;
- bool mSingleExpansion;
- bool mFitParent;
- bool mAutoScrolling;
- F32 mAutoScrollRate;
- LLTextBox* mNoVisibleTabsHelpText;
+ LLScrollbar* mScrollbar = nullptr;
+ bool mSingleExpansion = false;
+ bool mFitParent = false;
+ bool mAutoScrolling = false;
+ F32 mAutoScrollRate = 0.f;
+ LLTextBox* mNoVisibleTabsHelpText = nullptr;
- bool mSkipScrollToChild;
+ bool mSkipScrollToChild = false;
std::string mNoMatchedTabsOrigString;
std::string mNoVisibleTabsOrigString;
- LLAccordionCtrlTab* mSelectedTab;
- const LLTabComparator* mTabComparator;
+ LLAccordionCtrlTab* mSelectedTab = nullptr;
+ const LLTabComparator* mTabComparator = nullptr;
};
diff --git a/indra/llui/llaccordionctrltab.cpp b/indra/llui/llaccordionctrltab.cpp
index 6d58a2545c..ac66525030 100644
--- a/indra/llui/llaccordionctrltab.cpp
+++ b/indra/llui/llaccordionctrltab.cpp
@@ -602,15 +602,13 @@ void LLAccordionCtrlTab::setSelected(bool is_selected)
LLView* LLAccordionCtrlTab::findContainerView()
{
- child_list_const_iter_t it = getChildList()->begin(), it_end = getChildList()->end();
- while (it != it_end)
+ for (auto child : *getChildList())
{
- LLView* child = *(it++);
if (DD_HEADER_NAME != child->getName() && child->getVisible())
return child;
}
- return NULL;
+ return nullptr;
}
void LLAccordionCtrlTab::selectOnFocusReceived()
diff --git a/indra/llui/llbadge.cpp b/indra/llui/llbadge.cpp
index 55fbd72165..de06d56ae0 100644
--- a/indra/llui/llbadge.cpp
+++ b/indra/llui/llbadge.cpp
@@ -36,7 +36,7 @@ static LLDefaultChildRegistry::Register<LLBadge> r("badge");
static const S32 BADGE_OFFSET_NOT_SPECIFIED = 0x7FFFFFFF;
// Compiler optimization, generate extern template
-template class LLBadge* LLView::getChild<class LLBadge>(const std::string& name, bool recurse) const;
+template class LLBadge* LLView::getChild<class LLBadge>(std::string_view name, bool recurse) const;
LLBadge::Params::Params()
@@ -197,10 +197,10 @@ void renderBadgeBackground(F32 centerX, F32 centerY, F32 width, F32 height, cons
F32 x = LLFontGL::sCurOrigin.mX + centerX - width * 0.5f;
F32 y = LLFontGL::sCurOrigin.mY + centerY - height * 0.5f;
- LLRectf screen_rect(ll_round(x),
- ll_round(y),
- ll_round(x) + width,
- ll_round(y) + height);
+ LLRectf screen_rect((F32)ll_round(x),
+ (F32)ll_round(y),
+ (F32)ll_round(x) + width,
+ (F32)ll_round(y) + height);
LLVector4a vertices[6];
vertices[0].set(screen_rect.mLeft, screen_rect.mTop, 1.0f);
@@ -233,8 +233,6 @@ void LLBadge::draw()
// Calculate badge size based on label text
//
- LLWString badge_label_wstring = mLabel;
-
S32 badge_label_begin_offset = 0;
S32 badge_char_length = S32_MAX;
S32 badge_pixel_length = S32_MAX;
@@ -242,7 +240,7 @@ void LLBadge::draw()
bool do_not_use_ellipses = false;
F32 badge_width = (2.0f * mPaddingHoriz) +
- mGLFont->getWidthF32(badge_label_wstring.c_str(), badge_label_begin_offset, badge_char_length);
+ mGLFont->getWidthF32(mLabel.getWString().c_str(), badge_label_begin_offset, badge_char_length);
F32 badge_height = (2.0f * mPaddingVert) + mGLFont->getLineHeight();
@@ -304,7 +302,7 @@ void LLBadge::draw()
}
else
{
- badge_center_x = location_offset_horiz;
+ badge_center_x = (F32)location_offset_horiz;
}
// Compute y position
@@ -321,7 +319,7 @@ void LLBadge::draw()
}
else
{
- badge_center_y = location_offset_vert;
+ badge_center_y = (F32)location_offset_vert;
}
//
@@ -356,7 +354,7 @@ void LLBadge::draw()
// Draw the label
//
- mGLFont->render(badge_label_wstring,
+ mGLFont->render(mLabel.getWString(),
badge_label_begin_offset,
badge_center_x + mLabelOffsetHoriz,
badge_center_y + mLabelOffsetVert,
diff --git a/indra/llui/llbadge.h b/indra/llui/llbadge.h
index a6d584c6d7..77fe76f0da 100644
--- a/indra/llui/llbadge.h
+++ b/indra/llui/llbadge.h
@@ -171,7 +171,7 @@ private:
// Build time optimization, generate once in .cpp file
#ifndef LLBADGE_CPP
-extern template class LLBadge* LLView::getChild<class LLBadge>(const std::string& name, bool recurse) const;
+extern template class LLBadge* LLView::getChild<class LLBadge>(std::string_view name, bool recurse) const;
#endif
#endif // LL_LLBADGE_H
diff --git a/indra/llui/llbutton.cpp b/indra/llui/llbutton.cpp
index e6c045250e..30968225a8 100644
--- a/indra/llui/llbutton.cpp
+++ b/indra/llui/llbutton.cpp
@@ -56,7 +56,7 @@ static LLDefaultChildRegistry::Register<LLButton> r("button");
// Compiler optimization, generate extern template
template class LLButton* LLView::getChild<class LLButton>(
- const std::string& name, bool recurse) const;
+ std::string_view name, bool recurse) const;
// globals
S32 LLBUTTON_H_PAD = 4;
@@ -188,7 +188,7 @@ LLButton::LLButton(const LLButton::Params& p)
// Likewise, missing "p.button_flash_rate" is replaced by gSavedSettings.getF32("FlashPeriod").
// Note: flashing should be allowed in settings.xml (boolean key "EnableButtonFlashing").
S32 flash_count = p.button_flash_count.isProvided()? p.button_flash_count : 0;
- F32 flash_rate = p.button_flash_rate.isProvided()? p.button_flash_rate : 0.0;
+ F32 flash_rate = p.button_flash_rate.isProvided()? p.button_flash_rate : 0.0f;
mFlashingTimer = new LLFlashTimer ((LLFlashTimer::callback_t)NULL, flash_count, flash_rate);
}
else
@@ -796,9 +796,6 @@ void LLButton::draw()
if( ll::ui::SearchableControl::getHighlighted() )
label_color = ll::ui::SearchableControl::getHighlightColor();
- // Unselected label assignments
- LLWString label = getCurrentLabel();
-
// overlay with keyboard focus border
if (hasFocus())
{
@@ -927,8 +924,9 @@ void LLButton::draw()
}
// Draw label
- if( !label.empty() )
+ if( !getCurrentLabel().empty() ) // Unselected label assignments
{
+ LLWString label = getCurrentLabel();
LLWStringUtil::trim(label);
S32 x;
@@ -1082,10 +1080,10 @@ void LLButton::autoResize()
resize(getCurrentLabel());
}
-void LLButton::resize(LLUIString label)
+void LLButton::resize(const LLUIString& label)
{
// get label length
- S32 label_width = mGLFont->getWidth(label.getString());
+ S32 label_width = mGLFont->getWidth(label.getWString().c_str());
// get current btn length
S32 btn_width =getRect().getWidth();
// check if it need resize
@@ -1129,12 +1127,12 @@ void LLButton::setImageSelected(LLPointer<LLUIImage> image)
mImageSelected = image;
}
-void LLButton::setImageColor(const LLColor4& c)
+void LLButton::setImageColor(const LLUIColor& c)
{
mImageColor = c;
}
-void LLButton::setColor(const LLColor4& color)
+void LLButton::setColor(const LLUIColor& color)
{
setImageColor(color);
}
@@ -1273,7 +1271,7 @@ void LLButton::setFloaterToggle(LLUICtrl* ctrl, const LLSD& sdname)
// Set the button control value (toggle state) to the floater visibility control (Sets the value as well)
button->setControlVariable(LLFloater::getControlGroup()->getControl(vis_control_name));
// Set the clicked callback to toggle the floater
- button->setClickedCallback(boost::bind(&LLFloaterReg::toggleInstance, sdname, LLSD()));
+ button->setClickedCallback([=](LLUICtrl* ctrl, const LLSD& param) -> void { LLFloaterReg::toggleInstance(sdname.asString(), LLSD()); });
}
// static
diff --git a/indra/llui/llbutton.h b/indra/llui/llbutton.h
index fed5cdcc50..4ecea6d473 100644
--- a/indra/llui/llbutton.h
+++ b/indra/llui/llbutton.h
@@ -172,8 +172,8 @@ public:
virtual void onCommit();
- void setUnselectedLabelColor( const LLColor4& c ) { mUnselectedLabelColor = c; }
- void setSelectedLabelColor( const LLColor4& c ) { mSelectedLabelColor = c; }
+ void setUnselectedLabelColor( const LLUIColor& c ) { mUnselectedLabelColor = c; }
+ void setSelectedLabelColor( const LLUIColor& c ) { mSelectedLabelColor = c; }
void setUseEllipses( bool use_ellipses ) { mUseEllipses = use_ellipses; }
void setUseFontColor( bool use_font_color) { mUseFontColor = use_font_color; }
@@ -224,14 +224,14 @@ public:
const std::string getLabelSelected() const { return wstring_to_utf8str(mSelectedLabel); }
void setImageColor(const std::string& color_control);
- void setImageColor(const LLColor4& c);
- /*virtual*/ void setColor(const LLColor4& c);
+ void setImageColor(const LLUIColor& c);
+ /*virtual*/ void setColor(const LLUIColor& c);
void setImages(const std::string &image_name, const std::string &selected_name);
- void setDisabledImageColor(const LLColor4& c) { mDisabledImageColor = c; }
+ void setDisabledImageColor(const LLUIColor& c) { mDisabledImageColor = c; }
- void setDisabledSelectedLabelColor( const LLColor4& c ) { mDisabledSelectedLabelColor = c; }
+ void setDisabledSelectedLabelColor( const LLUIColor& c ) { mDisabledSelectedLabelColor = c; }
void setImageOverlay(const std::string& image_name, LLFontGL::HAlign alignment = LLFontGL::HCENTER, const LLColor4& color = LLColor4::white);
void setImageOverlay(const LLUUID& image_id, LLFontGL::HAlign alignment = LLFontGL::HCENTER, const LLColor4& color = LLColor4::white);
@@ -239,14 +239,14 @@ public:
LLFontGL::HAlign getImageOverlayHAlign() const { return mImageOverlayAlignment; }
void autoResize(); // resize with label of current btn state
- void resize(LLUIString label); // resize with label input
+ void resize(const LLUIString& label); // resize with label input
void setLabel(const std::string& label);
void setLabel(const LLUIString& label);
void setLabel( const LLStringExplicit& label);
virtual bool setLabelArg( const std::string& key, const LLStringExplicit& text );
void setLabelUnselected(const LLStringExplicit& label);
void setLabelSelected(const LLStringExplicit& label);
- void setDisabledLabelColor( const LLColor4& c ) { mDisabledLabelColor = c; }
+ void setDisabledLabelColor( const LLUIColor& c ) { mDisabledLabelColor = c; }
void setFont(const LLFontGL *font)
{ mGLFont = ( font ? font : LLFontGL::getFontSansSerif()); }
@@ -400,7 +400,7 @@ protected:
// Build time optimization, generate once in .cpp file
#ifndef LLBUTTON_CPP
extern template class LLButton* LLView::getChild<class LLButton>(
- const std::string& name, bool recurse) const;
+ std::string_view name, bool recurse) const;
#endif
#endif // LL_LLBUTTON_H
diff --git a/indra/llui/llcheckboxctrl.cpp b/indra/llui/llcheckboxctrl.cpp
index 3bcf0a6517..fc751cfc7f 100644
--- a/indra/llui/llcheckboxctrl.cpp
+++ b/indra/llui/llcheckboxctrl.cpp
@@ -45,7 +45,7 @@ static LLDefaultChildRegistry::Register<LLCheckBoxCtrl> r("check_box");
// Compiler optimization, generate extern template
template class LLCheckBoxCtrl* LLView::getChild<class LLCheckBoxCtrl>(
- const std::string& name, bool recurse) const;
+ std::string_view name, bool recurse) const;
void LLCheckBoxCtrl::WordWrap::declareValues()
{
@@ -172,11 +172,11 @@ void LLCheckBoxCtrl::setEnabled(bool b)
if (b)
{
- mLabel->setColor( mTextEnabledColor.get() );
+ mLabel->setColor( mTextEnabledColor );
}
else
{
- mLabel->setColor( mTextDisabledColor.get() );
+ mLabel->setColor( mTextDisabledColor );
}
}
diff --git a/indra/llui/llcheckboxctrl.h b/indra/llui/llcheckboxctrl.h
index 3058e946c3..135f128692 100644
--- a/indra/llui/llcheckboxctrl.h
+++ b/indra/llui/llcheckboxctrl.h
@@ -110,8 +110,8 @@ public:
void setBtnFocus() { mButton->setFocus(true); }
- void setEnabledColor( const LLColor4 &color ) { mTextEnabledColor = color; }
- void setDisabledColor( const LLColor4 &color ) { mTextDisabledColor = color; }
+ void setEnabledColor( const LLUIColor&color ) { mTextEnabledColor = color; }
+ void setDisabledColor( const LLUIColor&color ) { mTextDisabledColor = color; }
void setLabel( const LLStringExplicit& label );
std::string getLabel() const;
@@ -151,7 +151,7 @@ protected:
// Build time optimization, generate once in .cpp file
#ifndef LLCHECKBOXCTRL_CPP
extern template class LLCheckBoxCtrl* LLView::getChild<class LLCheckBoxCtrl>(
- const std::string& name, bool recurse) const;
+ std::string_view name, bool recurse) const;
#endif
#endif // LL_LLCHECKBOXCTRL_H
diff --git a/indra/llui/llcombobox.cpp b/indra/llui/llcombobox.cpp
index 79dce1c714..ee1700e009 100644
--- a/indra/llui/llcombobox.cpp
+++ b/indra/llui/llcombobox.cpp
@@ -875,6 +875,20 @@ bool LLComboBox::handleUnicodeCharHere(llwchar uni_char)
return result;
}
+// virtual
+bool LLComboBox::handleScrollWheel(S32 x, S32 y, S32 clicks)
+{
+ if (mList->getVisible()) return mList->handleScrollWheel(x, y, clicks);
+ if (mAllowTextEntry) // We might be editable
+ if (!mList->getFirstSelected()) // We aren't in the list, don't kill their text
+ return false;
+
+ setCurrentByIndex(llclamp(getCurrentIndex() + clicks, 0, getItemCount() - 1));
+ prearrangeList();
+ onCommit();
+ return true;
+}
+
void LLComboBox::setTextEntry(const LLStringExplicit& text)
{
if (mTextEntry)
diff --git a/indra/llui/llcombobox.h b/indra/llui/llcombobox.h
index cc1c2885fc..9dc6fa9257 100644
--- a/indra/llui/llcombobox.h
+++ b/indra/llui/llcombobox.h
@@ -114,6 +114,7 @@ public:
virtual bool handleToolTip(S32 x, S32 y, MASK mask);
virtual bool handleKeyHere(KEY key, MASK mask);
virtual bool handleUnicodeCharHere(llwchar uni_char);
+ virtual bool handleScrollWheel(S32 x, S32 y, S32 clicks);
// LLUICtrl interface
virtual void clear(); // select nothing
diff --git a/indra/llui/llconsole.cpp b/indra/llui/llconsole.cpp
index 9fbfb3e5fa..91e6f281da 100644
--- a/indra/llui/llconsole.cpp
+++ b/indra/llui/llconsole.cpp
@@ -80,7 +80,7 @@ void LLConsole::setLinePersistTime(F32 seconds)
void LLConsole::reshape(S32 width, S32 height, bool called_from_parent)
{
S32 new_width = llmax(50, llmin(getRect().getWidth(), width));
- S32 new_height = llmax(llfloor(mFont->getLineHeight()) + 15, llmin(getRect().getHeight(), height));
+ S32 new_height = llmax(mFont->getLineHeight() + 15, llmin(getRect().getHeight(), height));
if ( mConsoleWidth == new_width
&& mConsoleHeight == new_height )
@@ -183,10 +183,11 @@ void LLConsole::draw()
static LLCachedControl<F32> console_bg_opacity(*LLUI::getInstance()->mSettingGroups["config"], "ConsoleBackgroundOpacity", 0.7f);
F32 console_opacity = llclamp(console_bg_opacity(), 0.f, 1.f);
- LLColor4 color = LLUIColorTable::instance().getColor("ConsoleBackground");
+ static LLUIColor console_color = LLUIColorTable::instance().getColor("ConsoleBackground");
+ LLColor4 color = console_color;
color.mV[VALPHA] *= console_opacity;
- F32 line_height = mFont->getLineHeight();
+ F32 line_height = (F32)mFont->getLineHeight();
for(paragraph_it = mParagraphs.rbegin(); paragraph_it != mParagraphs.rend(); paragraph_it++)
{
diff --git a/indra/llui/llcontainerview.cpp b/indra/llui/llcontainerview.cpp
index 4c2912cde6..b414e4354d 100644
--- a/indra/llui/llcontainerview.cpp
+++ b/indra/llui/llcontainerview.cpp
@@ -46,7 +46,7 @@ static ContainerViewRegistry::Register<LLPanel> r3("panel", &LLPanel::fromXML);
LLContainerView::LLContainerView(const LLContainerView::Params& p)
: LLView(p),
mShowLabel(p.show_label),
- mLabel(p.label),
+ mLabel(utf8str_to_wstring(p.label)),
mDisplayChildren(p.display_children)
{
mScrollContainer = NULL;
@@ -120,8 +120,8 @@ void LLContainerView::draw()
// Draw the label
if (mShowLabel)
{
- LLFontGL::getFontMonospace()->renderUTF8(
- mLabel, 0, 2, getRect().getHeight() - 2, LLColor4(1,1,1,1), LLFontGL::LEFT, LLFontGL::TOP);
+ LLFontGL::getFontMonospace()->render(
+ mLabel, 0, 2.f, (F32)(getRect().getHeight() - 2), LLColor4(1,1,1,1), LLFontGL::LEFT, LLFontGL::TOP);
}
LLView::draw();
@@ -285,7 +285,7 @@ LLRect LLContainerView::getRequiredRect()
void LLContainerView::setLabel(const std::string& label)
{
- mLabel = label;
+ mLabel = utf8str_to_wstring(label);
}
void LLContainerView::setDisplayChildren(bool displayChildren)
diff --git a/indra/llui/llcontainerview.h b/indra/llui/llcontainerview.h
index 319fb7d5e9..c6dd401e85 100644
--- a/indra/llui/llcontainerview.h
+++ b/indra/llui/llcontainerview.h
@@ -89,6 +89,6 @@ public:
protected:
bool mDisplayChildren;
- std::string mLabel;
+ LLWString mLabel;
};
#endif // LL_CONTAINERVIEW_
diff --git a/indra/llui/lldockcontrol.cpp b/indra/llui/lldockcontrol.cpp
index bf0862e8a9..11dbad8c09 100644
--- a/indra/llui/lldockcontrol.cpp
+++ b/indra/llui/lldockcontrol.cpp
@@ -43,6 +43,8 @@ LLDockControl::LLDockControl(LLView* dockWidget, LLFloater* dockableFloater,
mDockWidgetHandle = dockWidget->getHandle();
}
+ mNonToolbarPanelHandle = mDockableFloater->getRootView()->getChild<LLView>("non_toolbar_panel")->getHandle();
+
if (dockableFloater->isDocked())
{
on();
@@ -97,7 +99,10 @@ void LLDockControl::setDock(LLView* dockWidget)
void LLDockControl::getAllowedRect(LLRect& rect)
{
- rect = mDockableFloater->getRootView()->getChild<LLView>("non_toolbar_panel")->getRect();
+ if(!mNonToolbarPanelHandle.isDead())
+ {
+ rect = mNonToolbarPanelHandle.get()->getRect();
+ }
}
void LLDockControl::repositionDockable()
diff --git a/indra/llui/lldockcontrol.h b/indra/llui/lldockcontrol.h
index fb0bf7d251..7e31330713 100644
--- a/indra/llui/lldockcontrol.h
+++ b/indra/llui/lldockcontrol.h
@@ -84,6 +84,7 @@ private:
bool mDockWidgetVisible;
DocAt mDockAt;
LLHandle<LLView> mDockWidgetHandle;
+ LLHandle<LLView> mNonToolbarPanelHandle;
LLRect mPrevDockRect;
LLRect mRootRect;
LLRect mFloaterRect;
diff --git a/indra/llui/llemojihelper.cpp b/indra/llui/llemojihelper.cpp
index fbe313924c..b9441a9c91 100644
--- a/indra/llui/llemojihelper.cpp
+++ b/indra/llui/llemojihelper.cpp
@@ -76,7 +76,9 @@ bool LLEmojiHelper::isCursorInEmojiCode(const LLWString& wtext, S32 cursorPos, S
shortCodePos--;
}
- bool isShortCode = (L':' == wtext[shortCodePos - 1]) && (cursorPos - shortCodePos >= 2);
+ bool isShortCode = (cursorPos - shortCodePos >= 2) && (L':' == wtext[shortCodePos - 1]);
+ if(isShortCode && (shortCodePos >= 2) && isdigit(wtext[shortCodePos - 2])) // <TS:3T> Add qualifier to avoid emoji pop-up when typing times.
+ isShortCode = false;
if (pShortCodePos)
*pShortCodePos = (isShortCode) ? shortCodePos - 1 : -1;
return isShortCode;
diff --git a/indra/llui/llf32uictrl.cpp b/indra/llui/llf32uictrl.cpp
index 52954ebbbb..9d041fffb0 100644
--- a/indra/llui/llf32uictrl.cpp
+++ b/indra/llui/llf32uictrl.cpp
@@ -37,7 +37,7 @@
LLF32UICtrl::LLF32UICtrl(const Params& p)
: LLUICtrl(p),
- mInitialValue(p.initial_value().asReal()),
+ mInitialValue((F32)p.initial_value().asReal()),
mMinValue(p.min_value),
mMaxValue(p.max_value),
mIncrement(p.increment)
@@ -47,5 +47,5 @@ LLF32UICtrl::LLF32UICtrl(const Params& p)
F32 LLF32UICtrl::getValueF32() const
{
- return mViewModel->getValue().asReal();
+ return (F32)mViewModel->getValue().asReal();
}
diff --git a/indra/llui/llflatlistview.cpp b/indra/llui/llflatlistview.cpp
index 1799968afb..53f39766c6 100644
--- a/indra/llui/llflatlistview.cpp
+++ b/indra/llui/llflatlistview.cpp
@@ -1250,17 +1250,15 @@ void LLFlatListView::detachItems(std::vector<LLPanel*>& detached_items)
detached_items.clear();
// Go through items and detach valid items, remove them from items panel
// and add to detached_items.
- pairs_iterator_t iter = mItemPairs.begin(), iter_end = mItemPairs.end();
- while (iter != iter_end)
+ for (auto item_pair : mItemPairs)
{
- LLPanel* pItem = (*iter)->first;
+ LLPanel* pItem = item_pair->first;
if (1 == pItem->notify(action))
{
- selectItemPair((*iter), false);
+ selectItemPair(item_pair, false);
mItemsPanel->removeChild(pItem);
- detached_items.push_back(pItem);
+ detached_items.emplace_back(pItem);
}
- iter++;
}
if (!detached_items.empty())
{
@@ -1268,12 +1266,10 @@ void LLFlatListView::detachItems(std::vector<LLPanel*>& detached_items)
if (detached_items.size() == mItemPairs.size())
{
// This way will be faster if all items were disconnected
- pairs_iterator_t iter = mItemPairs.begin(), iter_end = mItemPairs.end();
- while (iter != iter_end)
+ for (auto item_pair : mItemPairs)
{
- (*iter)->first = NULL;
- delete *iter;
- iter++;
+ item_pair->first = nullptr;
+ delete item_pair;
}
mItemPairs.clear();
// Also set items panel height to zero.
@@ -1286,26 +1282,16 @@ void LLFlatListView::detachItems(std::vector<LLPanel*>& detached_items)
}
else
{
- std::vector<LLPanel*>::const_iterator
- detached_iter = detached_items.begin(),
- detached_iter_end = detached_items.end();
- while (detached_iter < detached_iter_end)
+ for (auto detached_item : detached_items)
{
- LLPanel* pDetachedItem = *detached_iter;
- pairs_iterator_t iter = mItemPairs.begin(), iter_end = mItemPairs.end();
- while (iter != iter_end)
+ auto found_pos = std::find_if(mItemPairs.begin(), mItemPairs.end(), [detached_item](auto item_pair) { return item_pair->first == detached_item; });
+ if (found_pos != mItemPairs.end())
{
- item_pair_t* item_pair = *iter;
- if (item_pair->first == pDetachedItem)
- {
- mItemPairs.erase(iter);
- item_pair->first = NULL;
- delete item_pair;
- break;
- }
- iter++;
+ mItemPairs.erase(found_pos);
+ auto item_pair = *found_pos;
+ item_pair->first = nullptr;
+ delete item_pair;
}
- detached_iter++;
}
rearrangeItems();
}
@@ -1412,11 +1398,10 @@ void LLFlatListViewEx::filterItems(bool re_sort, bool notify_parent)
action.with("match_filter", cur_filter);
mHasMatchedItems = false;
- bool visibility_changed = false;
- pairs_const_iterator_t iter = getItemPairs().begin(), iter_end = getItemPairs().end();
- while (iter != iter_end)
+ bool visibility_changed{ false };
+ for (auto item_pair : getItemPairs())
{
- LLPanel* pItem = (*(iter++))->first;
+ LLPanel* pItem = item_pair->first;
visibility_changed |= updateItemVisibility(pItem, action);
}
diff --git a/indra/llui/llfloater.cpp b/indra/llui/llfloater.cpp
index f29f9286c9..ff174d8470 100644
--- a/indra/llui/llfloater.cpp
+++ b/indra/llui/llfloater.cpp
@@ -960,8 +960,8 @@ bool LLFloater::applyRectControl()
&& !x_control->isDefault()
&& !y_control->isDefault())
{
- mPosition.mX = x_control->getValue().asReal();
- mPosition.mY = y_control->getValue().asReal();
+ mPosition.mX = (LL_COORD_FLOATER::value_t)x_control->getValue().asReal();
+ mPosition.mY = (LL_COORD_FLOATER::value_t)y_control->getValue().asReal();
mPositioning = LLFloaterEnums::POSITIONING_RELATIVE;
applyRelativePosition();
@@ -1205,24 +1205,64 @@ void LLFloater::handleReshape(const LLRect& new_rect, bool by_user)
{
S32 delta_x = 0;
S32 delta_y = 0;
+
+ // take translation of dependee floater into account
+ delta_x += new_rect.mLeft - old_rect.mLeft;
+ delta_y += new_rect.mBottom - old_rect.mBottom;
+
// check to see if it snapped to right or top, and move if dependee floater is resizing
LLRect dependent_rect = floaterp->getRect();
- if (dependent_rect.mLeft - getRect().mLeft >= old_rect.getWidth() || // dependent on my right?
- dependent_rect.mRight == getRect().mLeft + old_rect.getWidth()) // dependent aligned with my right
+ if ((dependent_rect.mLeft - getRect().mLeft >= old_rect.getWidth() || // dependent on my right?
+ dependent_rect.mRight == getRect().mLeft + old_rect.getWidth()) // dependent aligned with my right
+ && dependent_rect.mBottom <= old_rect.mTop + 1)
{
// was snapped directly onto right side or aligned with it
delta_x += new_rect.getWidth() - old_rect.getWidth();
+
+ // make sure dependent still touches floater and din't go too high,
+ // it can go over edge, but should't detach completely
+ if (delta_y > 0
+ && dependent_rect.mBottom + delta_y > new_rect.mTop)
+ {
+ delta_y = llmax(new_rect.mTop - dependent_rect.mBottom, 0);
+ }
+ }
+ else if (dependent_rect.mRight == old_rect.mLeft)
+ {
+ // make sure dependent still touches floater and don't go too high
+ if (delta_y > 0
+ && dependent_rect.mBottom <= old_rect.mTop
+ && dependent_rect.mBottom + delta_y > new_rect.mTop)
+ {
+ delta_y = llmax(new_rect.mTop - dependent_rect.mBottom, 0);
+ }
}
- if (dependent_rect.mBottom - getRect().mBottom >= old_rect.getHeight() ||
- dependent_rect.mTop == getRect().mBottom + old_rect.getHeight())
+
+ if ((dependent_rect.mBottom - getRect().mBottom >= old_rect.getHeight() ||
+ dependent_rect.mTop == getRect().mBottom + old_rect.getHeight())
+ && dependent_rect.mLeft <= old_rect.mRight + 1)
{
// was snapped directly onto top side or aligned with it
delta_y += new_rect.getHeight() - old_rect.getHeight();
- }
- // take translation of dependee floater into account as well
- delta_x += new_rect.mLeft - old_rect.mLeft;
- delta_y += new_rect.mBottom - old_rect.mBottom;
+ // make sure dependent still touches floater
+ // and din't go too far to the right
+ if (delta_x > 0
+ && dependent_rect.mLeft + delta_x > new_rect.mRight)
+ {
+ delta_x = llmax(new_rect.mRight - dependent_rect.mLeft, 0);
+ }
+ }
+ else if (dependent_rect.mTop == old_rect.mBottom)
+ {
+ // make sure dependent still touches floater and don't go too far to the right
+ if (delta_x > 0
+ && dependent_rect.mLeft <= old_rect.mRight
+ && dependent_rect.mLeft + delta_x > new_rect.mRight)
+ {
+ delta_x = llmax(new_rect.mRight - dependent_rect.mLeft, 0);
+ }
+ }
dependent_rect.translate(delta_x, delta_y);
floaterp->setShape(dependent_rect, by_user);
@@ -3626,7 +3666,7 @@ void LLFloater::applyRelativePosition()
LLCoordFloater::LLCoordFloater(F32 x, F32 y, LLFloater& floater)
-: coord_t((S32)x, (S32)y)
+: coord_t(x, y)
{
mFloater = floater.getHandle();
}
@@ -3669,28 +3709,28 @@ LLCoordCommon LL_COORD_FLOATER::convertToCommon() const
LLCoordCommon out;
if (self.mX < -0.5f)
{
- out.mX = ll_round(rescale(self.mX, -1.f, -0.5f, snap_rect.mLeft - (floater_width - FLOATER_MIN_VISIBLE_PIXELS), snap_rect.mLeft));
+ out.mX = ll_round(rescale(self.mX, -1.f, -0.5f, (F32)(snap_rect.mLeft - (floater_width - FLOATER_MIN_VISIBLE_PIXELS)), (F32)snap_rect.mLeft));
}
else if (self.mX > 0.5f)
{
- out.mX = ll_round(rescale(self.mX, 0.5f, 1.f, snap_rect.mRight - floater_width, snap_rect.mRight - FLOATER_MIN_VISIBLE_PIXELS));
+ out.mX = ll_round(rescale(self.mX, 0.5f, 1.f, (F32)(snap_rect.mRight - floater_width), (F32)(snap_rect.mRight - FLOATER_MIN_VISIBLE_PIXELS)));
}
else
{
- out.mX = ll_round(rescale(self.mX, -0.5f, 0.5f, snap_rect.mLeft, snap_rect.mRight - floater_width));
+ out.mX = ll_round(rescale(self.mX, -0.5f, 0.5f, (F32)snap_rect.mLeft, (F32)(snap_rect.mRight - floater_width)));
}
if (self.mY < -0.5f)
{
- out.mY = ll_round(rescale(self.mY, -1.f, -0.5f, snap_rect.mBottom - (floater_height - FLOATER_MIN_VISIBLE_PIXELS), snap_rect.mBottom));
+ out.mY = ll_round(rescale(self.mY, -1.f, -0.5f, (F32)(snap_rect.mBottom - (floater_height - FLOATER_MIN_VISIBLE_PIXELS)), (F32)snap_rect.mBottom));
}
else if (self.mY > 0.5f)
{
- out.mY = ll_round(rescale(self.mY, 0.5f, 1.f, snap_rect.mTop - floater_height, snap_rect.mTop - FLOATER_MIN_VISIBLE_PIXELS));
+ out.mY = ll_round(rescale(self.mY, 0.5f, 1.f, (F32)(snap_rect.mTop - floater_height), (F32)(snap_rect.mTop - FLOATER_MIN_VISIBLE_PIXELS)));
}
else
{
- out.mY = ll_round(rescale(self.mY, -0.5f, 0.5f, snap_rect.mBottom, snap_rect.mTop - floater_height));
+ out.mY = ll_round(rescale(self.mY, -0.5f, 0.5f, (F32)snap_rect.mBottom, (F32)(snap_rect.mTop - floater_height)));
}
// return center point instead of lower left
@@ -3717,27 +3757,27 @@ void LL_COORD_FLOATER::convertFromCommon(const LLCoordCommon& from)
if (from_x < snap_rect.mLeft)
{
- self.mX = rescale(from_x, snap_rect.mLeft - (floater_width - FLOATER_MIN_VISIBLE_PIXELS), snap_rect.mLeft, -1.f, -0.5f);
+ self.mX = rescale((F32)from_x, (F32)(snap_rect.mLeft - (floater_width - FLOATER_MIN_VISIBLE_PIXELS)), (F32)snap_rect.mLeft, -1.f, -0.5f);
}
else if (from_x + floater_width > snap_rect.mRight)
{
- self.mX = rescale(from_x, snap_rect.mRight - floater_width, snap_rect.mRight - FLOATER_MIN_VISIBLE_PIXELS, 0.5f, 1.f);
+ self.mX = rescale((F32)from_x, (F32)(snap_rect.mRight - floater_width), (F32)(snap_rect.mRight - FLOATER_MIN_VISIBLE_PIXELS), 0.5f, 1.f);
}
else
{
- self.mX = rescale(from_x, snap_rect.mLeft, snap_rect.mRight - floater_width, -0.5f, 0.5f);
+ self.mX = rescale((F32)from_x, (F32)snap_rect.mLeft, (F32)(snap_rect.mRight - floater_width), -0.5f, 0.5f);
}
if (from_y < snap_rect.mBottom)
{
- self.mY = rescale(from_y, snap_rect.mBottom - (floater_height - FLOATER_MIN_VISIBLE_PIXELS), snap_rect.mBottom, -1.f, -0.5f);
+ self.mY = rescale((F32)from_y, (F32)(snap_rect.mBottom - (floater_height - FLOATER_MIN_VISIBLE_PIXELS)), (F32)snap_rect.mBottom, -1.f, -0.5f);
}
else if (from_y + floater_height > snap_rect.mTop)
{
- self.mY = rescale(from_y, snap_rect.mTop - floater_height, snap_rect.mTop - FLOATER_MIN_VISIBLE_PIXELS, 0.5f, 1.f);
+ self.mY = rescale((F32)from_y, (F32)(snap_rect.mTop - floater_height), (F32)(snap_rect.mTop - FLOATER_MIN_VISIBLE_PIXELS), 0.5f, 1.f);
}
else
{
- self.mY = rescale(from_y, snap_rect.mBottom, snap_rect.mTop - floater_height, -0.5f, 0.5f);
+ self.mY = rescale((F32)from_y, (F32)snap_rect.mBottom, (F32)(snap_rect.mTop - floater_height), -0.5f, 0.5f);
}
}
diff --git a/indra/llui/llfloaterreg.cpp b/indra/llui/llfloaterreg.cpp
index fd5a370bc3..a818e72f59 100644
--- a/indra/llui/llfloaterreg.cpp
+++ b/indra/llui/llfloaterreg.cpp
@@ -40,9 +40,9 @@
LLFloaterReg::instance_list_t LLFloaterReg::sNullInstanceList;
LLFloaterReg::instance_map_t LLFloaterReg::sInstanceMap;
LLFloaterReg::build_map_t LLFloaterReg::sBuildMap;
-std::map<std::string,std::string> LLFloaterReg::sGroupMap;
+std::map<std::string, std::string, std::less<>> LLFloaterReg::sGroupMap;
bool LLFloaterReg::sBlockShowFloaters = false;
-std::set<std::string> LLFloaterReg::sAlwaysShowableList;
+std::set<std::string, std::less<>> LLFloaterReg::sAlwaysShowableList;
static LLFloaterRegListener sFloaterRegListener;
@@ -58,27 +58,31 @@ void LLFloaterReg::add(const std::string& name, const std::string& filename, con
}
//static
-bool LLFloaterReg::isRegistered(const std::string& name)
+bool LLFloaterReg::isRegistered(std::string_view name)
{
return sBuildMap.find(name) != sBuildMap.end();
}
//static
-LLFloater* LLFloaterReg::getLastFloaterInGroup(const std::string& name)
+LLFloater* LLFloaterReg::getLastFloaterInGroup(std::string_view name)
{
- const std::string& groupname = sGroupMap[name];
- if (!groupname.empty())
+ auto it = sGroupMap.find(name);
+ if (it != sGroupMap.end())
{
- instance_list_t& list = sInstanceMap[groupname];
- if (!list.empty())
+ const std::string& groupname = it->second;
+ if (!groupname.empty())
{
- for (instance_list_t::reverse_iterator iter = list.rbegin(); iter != list.rend(); ++iter)
+ instance_list_t& list = sInstanceMap[groupname];
+ if (!list.empty())
{
- LLFloater* inst = *iter;
-
- if (inst->getVisible() && !inst->isMinimized())
+ for (instance_list_t::reverse_iterator iter = list.rbegin(), end = list.rend(); iter != end; ++iter)
{
- return inst;
+ LLFloater* inst = *iter;
+
+ if (inst->getVisible() && !inst->isMinimized())
+ {
+ return inst;
+ }
}
}
}
@@ -99,10 +103,8 @@ LLFloater* LLFloaterReg::getLastFloaterCascading()
instance_list_t& instances = sInstanceMap[group_name];
- for (instance_list_t::const_iterator iter = instances.begin(); iter != instances.end(); ++iter)
+ for (LLFloater* inst : instances)
{
- LLFloater* inst = *iter;
-
if (inst->getVisible()
&& (inst->isPositioning(LLFloaterEnums::POSITIONING_CASCADING)
|| inst->isPositioning(LLFloaterEnums::POSITIONING_CASCADE_GROUP)))
@@ -120,20 +122,23 @@ LLFloater* LLFloaterReg::getLastFloaterCascading()
}
//static
-LLFloater* LLFloaterReg::findInstance(const std::string& name, const LLSD& key)
+LLFloater* LLFloaterReg::findInstance(std::string_view name, const LLSD& key)
{
LLFloater* res = NULL;
- const std::string& groupname = sGroupMap[name];
- if (!groupname.empty())
+ auto it = sGroupMap.find(name);
+ if (it != sGroupMap.end())
{
- instance_list_t& list = sInstanceMap[groupname];
- for (instance_list_t::iterator iter = list.begin(); iter != list.end(); ++iter)
+ const std::string& groupname = it->second;
+ if (!groupname.empty())
{
- LLFloater* inst = *iter;
- if (inst->matchesKey(key))
+ instance_list_t& list = sInstanceMap[groupname];
+ for (LLFloater* inst : list)
{
- res = inst;
- break;
+ if (inst->matchesKey(key))
+ {
+ res = inst;
+ break;
+ }
}
}
}
@@ -141,47 +146,55 @@ LLFloater* LLFloaterReg::findInstance(const std::string& name, const LLSD& key)
}
//static
-LLFloater* LLFloaterReg::getInstance(const std::string& name, const LLSD& key)
+LLFloater* LLFloaterReg::getInstance(std::string_view name, const LLSD& key)
{
LLFloater* res = findInstance(name, key);
if (!res)
{
- const LLFloaterBuildFunc& build_func = sBuildMap[name].mFunc;
- const std::string& xui_file = sBuildMap[name].mFile;
- if (build_func)
+ auto it = sBuildMap.find(name);
+ if (it != sBuildMap.end())
{
- const std::string& groupname = sGroupMap[name];
- if (!groupname.empty())
+ const LLFloaterBuildFunc& build_func = it->second.mFunc;
+ const std::string& xui_file = it->second.mFile;
+ if (build_func)
{
- instance_list_t& list = sInstanceMap[groupname];
-
- res = build_func(key);
- if (!res)
- {
- LL_WARNS() << "Failed to build floater type: '" << name << "'." << LL_ENDL;
- return NULL;
- }
- bool success = res->buildFromFile(xui_file);
- if (!success)
+ auto it = sGroupMap.find(name);
+ if (it != sGroupMap.end())
{
- LL_WARNS() << "Failed to build floater type: '" << name << "'." << LL_ENDL;
- return NULL;
+ const std::string& groupname = it->second;
+ if (!groupname.empty())
+ {
+ instance_list_t& list = sInstanceMap[groupname];
+
+ res = build_func(key);
+ if (!res)
+ {
+ LL_WARNS() << "Failed to build floater type: '" << name << "'." << LL_ENDL;
+ return NULL;
+ }
+ bool success = res->buildFromFile(xui_file);
+ if (!success)
+ {
+ LL_WARNS() << "Failed to build floater type: '" << name << "'." << LL_ENDL;
+ return NULL;
+ }
+
+ // Note: key should eventually be a non optional LLFloater arg; for now, set mKey to be safe
+ if (res->mKey.isUndefined())
+ {
+ res->mKey = key;
+ }
+ res->setInstanceName(std::string(name));
+
+ LLFloater* last_floater = (list.empty() ? NULL : list.back());
+
+ res->applyControlsAndPosition(last_floater);
+
+ gFloaterView->adjustToFitScreen(res, false);
+
+ list.push_back(res);
+ }
}
-
- // Note: key should eventually be a non optional LLFloater arg; for now, set mKey to be safe
- if (res->mKey.isUndefined())
- {
- res->mKey = key;
- }
- res->setInstanceName(name);
-
- LLFloater *last_floater = (list.empty() ? NULL : list.back());
-
- res->applyControlsAndPosition(last_floater);
-
- gFloaterView->adjustToFitScreen(res, false);
-
- list.push_back(res);
}
}
if (!res)
@@ -193,21 +206,25 @@ LLFloater* LLFloaterReg::getInstance(const std::string& name, const LLSD& key)
}
//static
-LLFloater* LLFloaterReg::removeInstance(const std::string& name, const LLSD& key)
+LLFloater* LLFloaterReg::removeInstance(std::string_view name, const LLSD& key)
{
LLFloater* res = NULL;
- const std::string& groupname = sGroupMap[name];
- if (!groupname.empty())
+ auto it = sGroupMap.find(name);
+ if (it != sGroupMap.end())
{
- instance_list_t& list = sInstanceMap[groupname];
- for (instance_list_t::iterator iter = list.begin(); iter != list.end(); ++iter)
+ const std::string& groupname = it->second;
+ if (!groupname.empty())
{
- LLFloater* inst = *iter;
- if (inst->matchesKey(key))
+ instance_list_t& list = sInstanceMap[groupname];
+ for (instance_list_t::iterator iter = list.begin(); iter != list.end(); ++iter)
{
- res = inst;
- list.erase(iter);
- break;
+ LLFloater* inst = *iter;
+ if (inst->matchesKey(key))
+ {
+ res = inst;
+ list.erase(iter);
+ break;
+ }
}
}
}
@@ -216,7 +233,7 @@ LLFloater* LLFloaterReg::removeInstance(const std::string& name, const LLSD& key
//static
// returns true if the instance existed
-bool LLFloaterReg::destroyInstance(const std::string& name, const LLSD& key)
+bool LLFloaterReg::destroyInstance(std::string_view name, const LLSD& key)
{
LLFloater* inst = removeInstance(name, key);
if (inst)
@@ -232,7 +249,7 @@ bool LLFloaterReg::destroyInstance(const std::string& name, const LLSD& key)
// Iterators
//static
-LLFloaterReg::const_instance_list_t& LLFloaterReg::getFloaterList(const std::string& name)
+LLFloaterReg::const_instance_list_t& LLFloaterReg::getFloaterList(std::string_view name)
{
instance_map_t::iterator iter = sInstanceMap.find(name);
if (iter != sInstanceMap.end())
@@ -248,7 +265,7 @@ LLFloaterReg::const_instance_list_t& LLFloaterReg::getFloaterList(const std::str
// Visibility Management
//static
-LLFloater* LLFloaterReg::showInstance(const std::string& name, const LLSD& key, bool focus)
+LLFloater* LLFloaterReg::showInstance(std::string_view name, const LLSD& key, bool focus)
{
if( sBlockShowFloaters
// see EXT-7090
@@ -266,7 +283,7 @@ LLFloater* LLFloaterReg::showInstance(const std::string& name, const LLSD& key,
//static
// returns true if the instance exists
-bool LLFloaterReg::hideInstance(const std::string& name, const LLSD& key)
+bool LLFloaterReg::hideInstance(std::string_view name, const LLSD& key)
{
LLFloater* instance = findInstance(name, key);
if (instance)
@@ -278,7 +295,7 @@ bool LLFloaterReg::hideInstance(const std::string& name, const LLSD& key)
//static
// returns true if the instance is visible when completed
-bool LLFloaterReg::toggleInstance(const std::string& name, const LLSD& key)
+bool LLFloaterReg::toggleInstance(std::string_view name, const LLSD& key)
{
LLFloater* instance = findInstance(name, key);
if (instance && instance->isShown())
@@ -294,7 +311,7 @@ bool LLFloaterReg::toggleInstance(const std::string& name, const LLSD& key)
//static
// returns true if the instance exists and is visible (doesnt matter minimized or not)
-bool LLFloaterReg::instanceVisible(const std::string& name, const LLSD& key)
+bool LLFloaterReg::instanceVisible(std::string_view name, const LLSD& key)
{
LLFloater* instance = findInstance(name, key);
return LLFloater::isVisible(instance);
diff --git a/indra/llui/llfloaterreg.h b/indra/llui/llfloaterreg.h
index 6a642cbb27..94a67c8d8b 100644
--- a/indra/llui/llfloaterreg.h
+++ b/indra/llui/llfloaterreg.h
@@ -51,26 +51,26 @@ public:
// 2) We can change the key of a floater without altering the list.
typedef std::list<LLFloater*> instance_list_t;
typedef const instance_list_t const_instance_list_t;
- typedef std::map<std::string, instance_list_t> instance_map_t;
+ typedef std::map<std::string, instance_list_t, std::less<>> instance_map_t;
struct BuildData
{
LLFloaterBuildFunc mFunc;
std::string mFile;
};
- typedef std::map<std::string, BuildData> build_map_t;
+ typedef std::map<std::string, BuildData, std::less<>> build_map_t;
private:
friend class LLFloaterRegListener;
static instance_list_t sNullInstanceList;
static instance_map_t sInstanceMap;
static build_map_t sBuildMap;
- static std::map<std::string,std::string> sGroupMap;
+ static std::map<std::string, std::string, std::less<>> sGroupMap;
static bool sBlockShowFloaters;
/**
* Defines list of floater names that can be shown despite state of sBlockShowFloaters.
*/
- static std::set<std::string> sAlwaysShowableList;
+ static std::set<std::string, std::less<>> sAlwaysShowableList;
public:
// Registration
@@ -85,30 +85,30 @@ public:
static void add(const std::string& name, const std::string& file, const LLFloaterBuildFunc& func,
const std::string& groupname = LLStringUtil::null);
- static bool isRegistered(const std::string& name);
+ static bool isRegistered(std::string_view name);
// Helpers
- static LLFloater* getLastFloaterInGroup(const std::string& name);
+ static LLFloater* getLastFloaterInGroup(std::string_view name);
static LLFloater* getLastFloaterCascading();
// Find / get (create) / remove / destroy
- static LLFloater* findInstance(const std::string& name, const LLSD& key = LLSD());
- static LLFloater* getInstance(const std::string& name, const LLSD& key = LLSD());
- static LLFloater* removeInstance(const std::string& name, const LLSD& key = LLSD());
- static bool destroyInstance(const std::string& name, const LLSD& key = LLSD());
+ static LLFloater* findInstance(std::string_view name, const LLSD& key = LLSD());
+ static LLFloater* getInstance(std::string_view name, const LLSD& key = LLSD());
+ static LLFloater* removeInstance(std::string_view name, const LLSD& key = LLSD());
+ static bool destroyInstance(std::string_view name, const LLSD& key = LLSD());
// Iterators
- static const_instance_list_t& getFloaterList(const std::string& name);
+ static const_instance_list_t& getFloaterList(std::string_view name);
// Visibility Management
// return NULL if instance not found or can't create instance (no builder)
- static LLFloater* showInstance(const std::string& name, const LLSD& key = LLSD(), bool focus = false);
+ static LLFloater* showInstance(std::string_view name, const LLSD& key = LLSD(), bool focus = false);
// Close a floater (may destroy or set invisible)
// return false if can't find instance
- static bool hideInstance(const std::string& name, const LLSD& key = LLSD());
+ static bool hideInstance(std::string_view name, const LLSD& key = LLSD());
// return true if instance is visible:
- static bool toggleInstance(const std::string& name, const LLSD& key = LLSD());
- static bool instanceVisible(const std::string& name, const LLSD& key = LLSD());
+ static bool toggleInstance(std::string_view name, const LLSD& key = LLSD());
+ static bool instanceVisible(std::string_view name, const LLSD& key = LLSD());
static void showInitialVisibleInstances();
static void hideVisibleInstances(const std::set<std::string>& exceptions = std::set<std::string>());
@@ -133,19 +133,19 @@ public:
// Typed find / get / show
template <class T>
- static T* findTypedInstance(const std::string& name, const LLSD& key = LLSD())
+ static T* findTypedInstance(std::string_view name, const LLSD& key = LLSD())
{
return dynamic_cast<T*>(findInstance(name, key));
}
template <class T>
- static T* getTypedInstance(const std::string& name, const LLSD& key = LLSD())
+ static T* getTypedInstance(std::string_view name, const LLSD& key = LLSD())
{
return dynamic_cast<T*>(getInstance(name, key));
}
template <class T>
- static T* showTypedInstance(const std::string& name, const LLSD& key = LLSD(), bool focus = false)
+ static T* showTypedInstance(std::string_view name, const LLSD& key = LLSD(), bool focus = false)
{
return dynamic_cast<T*>(showInstance(name, key, focus));
}
diff --git a/indra/llui/llfloaterreglistener.cpp b/indra/llui/llfloaterreglistener.cpp
index aa3d1a1171..17641b8375 100644
--- a/indra/llui/llfloaterreglistener.cpp
+++ b/indra/llui/llfloaterreglistener.cpp
@@ -94,22 +94,22 @@ void LLFloaterRegListener::getBuildMap(const LLSD& event) const
void LLFloaterRegListener::showInstance(const LLSD& event) const
{
- LLFloaterReg::showInstance(event["name"], event["key"], event["focus"]);
+ LLFloaterReg::showInstance(event["name"].asString(), event["key"], event["focus"]);
}
void LLFloaterRegListener::hideInstance(const LLSD& event) const
{
- LLFloaterReg::hideInstance(event["name"], event["key"]);
+ LLFloaterReg::hideInstance(event["name"].asString(), event["key"]);
}
void LLFloaterRegListener::toggleInstance(const LLSD& event) const
{
- LLFloaterReg::toggleInstance(event["name"], event["key"]);
+ LLFloaterReg::toggleInstance(event["name"].asString(), event["key"]);
}
void LLFloaterRegListener::instanceVisible(const LLSD& event) const
{
- sendReply(LLSDMap("visible", LLFloaterReg::instanceVisible(event["name"], event["key"])),
+ sendReply(LLSDMap("visible", LLFloaterReg::instanceVisible(event["name"].asString(), event["key"])),
event);
}
@@ -119,7 +119,7 @@ void LLFloaterRegListener::clickButton(const LLSD& event) const
LLReqID reqID(event);
LLSD reply(reqID.makeResponse());
- LLFloater* floater = LLFloaterReg::findInstance(event["name"], event["key"]);
+ LLFloater* floater = LLFloaterReg::findInstance(event["name"].asString(), event["key"]);
if (! LLFloater::isShown(floater))
{
reply["type"] = "LLFloater";
@@ -131,7 +131,7 @@ void LLFloaterRegListener::clickButton(const LLSD& event) const
{
// Here 'floater' points to an LLFloater instance with the specified
// name and key which isShown().
- LLButton* button = floater->findChild<LLButton>(event["button"]);
+ LLButton* button = floater->findChild<LLButton>(event["button"].asString());
if (! LLButton::isAvailable(button))
{
reply["type"] = "LLButton";
diff --git a/indra/llui/llfocusmgr.cpp b/indra/llui/llfocusmgr.cpp
index e0e789f730..4f3d2328aa 100644
--- a/indra/llui/llfocusmgr.cpp
+++ b/indra/llui/llfocusmgr.cpp
@@ -79,10 +79,20 @@ bool LLFocusableElement::wantsReturnKey() const
// virtual
LLFocusableElement::~LLFocusableElement()
{
- delete mFocusLostCallback;
- delete mFocusReceivedCallback;
- delete mFocusChangedCallback;
- delete mTopLostCallback;
+ auto free_signal = [&](focus_signal_t*& signal)
+ {
+ if (signal)
+ {
+ signal->disconnect_all_slots();
+ delete signal;
+ signal = nullptr;
+ }
+ };
+
+ free_signal(mFocusLostCallback);
+ free_signal(mFocusReceivedCallback);
+ free_signal(mFocusChangedCallback);
+ free_signal(mTopLostCallback);
}
void LLFocusableElement::onFocusReceived()
@@ -189,7 +199,7 @@ void LLFocusMgr::releaseFocusIfNeeded( LLView* view )
}
}
- LLUI::getInstance()->removePopup(view);
+ if(LLUI::instanceExists()) LLUI::getInstance()->removePopup(view);
}
void LLFocusMgr::setKeyboardFocus(LLFocusableElement* new_focus, bool lock, bool keystrokes_only)
@@ -487,7 +497,7 @@ void LLFocusMgr::setAppHasFocus(bool focus)
// release focus from "top ctrl"s, which generally hides them
if (!focus)
{
- LLUI::getInstance()->clearPopups();
+ if(LLUI::instanceExists()) LLUI::getInstance()->clearPopups();
}
mAppHasFocus = focus;
}
diff --git a/indra/llui/llfolderview.cpp b/indra/llui/llfolderview.cpp
index 1d4ecbe9c9..388dc5b1ac 100644
--- a/indra/llui/llfolderview.cpp
+++ b/indra/llui/llfolderview.cpp
@@ -211,7 +211,7 @@ LLFolderView::LLFolderView(const Params& p)
//clear label
// go ahead and render root folder as usual
// just make sure the label ("Inventory Folder") never shows up
- mLabel = LLStringUtil::null;
+ mLabel.clear();
// Escape is handled by reverting the rename, not commiting it (default behavior)
LLLineEditor::Params params;
diff --git a/indra/llui/llfolderviewitem.cpp b/indra/llui/llfolderviewitem.cpp
index 82cd2483e8..e4f5664908 100644
--- a/indra/llui/llfolderviewitem.cpp
+++ b/indra/llui/llfolderviewitem.cpp
@@ -140,7 +140,7 @@ LLFolderViewItem::LLFolderViewItem(const LLFolderViewItem::Params& p)
mItemHeight(p.item_height),
mControlLabelRotation(0.f),
mDragAndDropTarget(false),
- mLabel(p.name),
+ mLabel(utf8str_to_wstring(p.name)),
mRoot(p.root),
mViewModelItem(p.listener),
mIsMouseOverTitle(false),
@@ -193,7 +193,7 @@ bool LLFolderViewItem::postBuild()
{
// getDisplayName() is expensive (due to internal getLabelSuffix() and name building)
// it also sets search strings so it requires a filter reset
- mLabel = vmi->getDisplayName();
+ mLabel = utf8str_to_wstring(vmi->getDisplayName());
setToolTip(vmi->getName());
// Dirty the filter flag of the model from the view (CHUI-849)
@@ -306,7 +306,7 @@ void LLFolderViewItem::refresh()
{
LLFolderViewModelItem& vmi = *getViewModelItem();
- mLabel = vmi.getDisplayName();
+ mLabel = utf8str_to_wstring(vmi.getDisplayName());
setToolTip(vmi.getName());
// icons are slightly expensive to get, can be optimized
// see LLInventoryIcon::getIcon()
@@ -319,7 +319,7 @@ void LLFolderViewItem::refresh()
// Very Expensive!
// Can do a number of expensive checks, like checking active motions, wearables or friend list
mLabelStyle = vmi.getLabelStyle();
- mLabelSuffix = vmi.getLabelSuffix();
+ mLabelSuffix = utf8str_to_wstring(vmi.getLabelSuffix());
}
// Dirty the filter flag of the model from the view (CHUI-849)
@@ -344,7 +344,7 @@ void LLFolderViewItem::refreshSuffix()
// Very Expensive!
// Can do a number of expensive checks, like checking active motions, wearables or friend list
mLabelStyle = vmi->getLabelStyle();
- mLabelSuffix = vmi->getLabelSuffix();
+ mLabelSuffix = utf8str_to_wstring(vmi->getLabelSuffix());
}
mLabelWidthDirty = true;
@@ -405,7 +405,7 @@ S32 LLFolderViewItem::arrange( S32* width, S32* height )
// it is purely visual, so it is fine to do at our laisure
refreshSuffix();
}
- mLabelWidth = getLabelXPos() + getLabelFontForStyle(mLabelStyle)->getWidth(mLabel) + getLabelFontForStyle(LLFontGL::NORMAL)->getWidth(mLabelSuffix) + mLabelPaddingRight;
+ mLabelWidth = getLabelXPos() + getLabelFontForStyle(mLabelStyle)->getWidth(mLabel.c_str()) + getLabelFontForStyle(LLFontGL::NORMAL)->getWidth(mLabelSuffix.c_str()) + mLabelPaddingRight;
mLabelWidthDirty = false;
}
@@ -784,7 +784,7 @@ void LLFolderViewItem::drawHighlight(const bool showContent, const bool hasKeybo
const S32 FOCUS_LEFT = 1;
// Determine which background color to use for highlighting
- LLUIColor bgColor = (isFlashing() ? flashColor : selectColor);
+ const LLUIColor& bgColor = (isFlashing() ? flashColor : selectColor);
//--------------------------------------------------------------------------------//
// Draw highlight for selected items
@@ -890,7 +890,7 @@ void LLFolderViewItem::drawLabel(const LLFontGL * font, const F32 x, const F32 y
//--------------------------------------------------------------------------------//
// Draw the actual label text
//
- font->renderUTF8(mLabel, 0, x, y, color,
+ font->render(mLabel, 0, x, y, color,
LLFontGL::LEFT, LLFontGL::BOTTOM, LLFontGL::NORMAL, LLFontGL::NO_SHADOW,
S32_MAX, getRect().getWidth() - (S32) x - mLabelPaddingRight, &right_x, /*use_ellipses*/true);
}
@@ -944,18 +944,18 @@ void LLFolderViewItem::draw()
F32 right_x = 0;
F32 y = (F32)getRect().getHeight() - font->getLineHeight() - (F32)mTextPad - (F32)TOP_PAD;
F32 text_left = (F32)getLabelXPos();
- std::string combined_string = mLabel + mLabelSuffix;
+ LLWString combined_string = mLabel + mLabelSuffix;
const LLFontGL* suffix_font = getLabelFontForStyle(LLFontGL::NORMAL);
S32 filter_offset = static_cast<S32>(mViewModelItem->getFilterStringOffset());
if (filter_string_length > 0)
{
- S32 bottom = llfloor(getRect().getHeight() - font->getLineHeight() - 3 - TOP_PAD);
+ S32 bottom = getRect().getHeight() - font->getLineHeight() - 3 - TOP_PAD;
S32 top = getRect().getHeight() - TOP_PAD;
if(mLabelSuffix.empty() || (font == suffix_font))
{
- S32 left = ll_round(text_left) + font->getWidth(combined_string, 0, static_cast<S32>(mViewModelItem->getFilterStringOffset())) - 2;
- S32 right = left + font->getWidth(combined_string, static_cast<S32>(mViewModelItem->getFilterStringOffset()), filter_string_length) + 2;
+ S32 left = ll_round(text_left) + font->getWidth(combined_string.c_str(), 0, static_cast<S32>(mViewModelItem->getFilterStringOffset())) - 2;
+ S32 right = left + font->getWidth(combined_string.c_str(), static_cast<S32>(mViewModelItem->getFilterStringOffset()), filter_string_length) + 2;
LLUIImage* box_image = default_params.selection_image;
LLRect box_rect(left, top, right, bottom);
@@ -966,8 +966,8 @@ void LLFolderViewItem::draw()
S32 label_filter_length = llmin((S32)mLabel.size() - filter_offset, (S32)filter_string_length);
if(label_filter_length > 0)
{
- S32 left = ll_round(text_left) + font->getWidthF32(mLabel, 0, llmin(filter_offset, (S32)mLabel.size())) - 2;
- S32 right = left + font->getWidthF32(mLabel, filter_offset, label_filter_length) + 2;
+ S32 left = (S32)(ll_round(text_left) + font->getWidthF32(mLabel.c_str(), 0, llmin(filter_offset, (S32)mLabel.size()))) - 2;
+ S32 right = left + (S32)font->getWidthF32(mLabel.c_str(), filter_offset, label_filter_length) + 2;
LLUIImage* box_image = default_params.selection_image;
LLRect box_rect(left, top, right, bottom);
box_image->draw(box_rect, sFilterBGColor);
@@ -976,8 +976,8 @@ void LLFolderViewItem::draw()
if(suffix_filter_length > 0)
{
S32 suffix_offset = llmax(0, filter_offset - (S32)mLabel.size());
- S32 left = ll_round(text_left) + font->getWidthF32(mLabel, 0, static_cast<S32>(mLabel.size())) + suffix_font->getWidthF32(mLabelSuffix, 0, suffix_offset) - 2;
- S32 right = left + suffix_font->getWidthF32(mLabelSuffix, suffix_offset, suffix_filter_length) + 2;
+ S32 left = (S32)(ll_round(text_left) + font->getWidthF32(mLabel.c_str(), 0, static_cast<S32>(mLabel.size())) + suffix_font->getWidthF32(mLabelSuffix.c_str(), 0, suffix_offset)) - 2;
+ S32 right = left + (S32)suffix_font->getWidthF32(mLabelSuffix.c_str(), suffix_offset, suffix_filter_length) + 2;
LLUIImage* box_image = default_params.selection_image;
LLRect box_rect(left, top, right, bottom);
box_image->draw(box_rect, sFilterBGColor);
@@ -999,7 +999,7 @@ void LLFolderViewItem::draw()
//
if (!mLabelSuffix.empty())
{
- suffix_font->renderUTF8( mLabelSuffix, 0, right_x, y, isFadeItem() ? color : (LLColor4)sSuffixColor,
+ suffix_font->render( mLabelSuffix, 0, right_x, y, isFadeItem() ? color : sSuffixColor.get(),
LLFontGL::LEFT, LLFontGL::BOTTOM, LLFontGL::NORMAL, LLFontGL::NO_SHADOW,
S32_MAX, S32_MAX, &right_x);
}
@@ -1011,9 +1011,9 @@ void LLFolderViewItem::draw()
{
if(mLabelSuffix.empty() || (font == suffix_font))
{
- F32 match_string_left = text_left + font->getWidthF32(combined_string, 0, filter_offset + filter_string_length) - font->getWidthF32(combined_string, filter_offset, filter_string_length);
+ F32 match_string_left = text_left + font->getWidthF32(combined_string.c_str(), 0, filter_offset + filter_string_length) - font->getWidthF32(combined_string.c_str(), filter_offset, filter_string_length);
F32 yy = (F32)getRect().getHeight() - font->getLineHeight() - (F32)mTextPad - (F32)TOP_PAD;
- font->renderUTF8(combined_string, filter_offset, match_string_left, yy,
+ font->render(combined_string, filter_offset, match_string_left, yy,
sFilterTextColor, LLFontGL::LEFT, LLFontGL::BOTTOM, LLFontGL::NORMAL, LLFontGL::NO_SHADOW,
filter_string_length, S32_MAX, &right_x);
}
@@ -1022,9 +1022,9 @@ void LLFolderViewItem::draw()
S32 label_filter_length = llmin((S32)mLabel.size() - filter_offset, (S32)filter_string_length);
if(label_filter_length > 0)
{
- F32 match_string_left = text_left + font->getWidthF32(mLabel, 0, filter_offset + label_filter_length) - font->getWidthF32(mLabel, filter_offset, label_filter_length);
+ F32 match_string_left = text_left + font->getWidthF32(mLabel.c_str(), 0, filter_offset + label_filter_length) - font->getWidthF32(mLabel.c_str(), filter_offset, label_filter_length);
F32 yy = (F32)getRect().getHeight() - font->getLineHeight() - (F32)mTextPad - (F32)TOP_PAD;
- font->renderUTF8(mLabel, filter_offset, match_string_left, yy,
+ font->render(mLabel, filter_offset, match_string_left, yy,
sFilterTextColor, LLFontGL::LEFT, LLFontGL::BOTTOM, LLFontGL::NORMAL, LLFontGL::NO_SHADOW,
label_filter_length, S32_MAX, &right_x);
}
@@ -1033,9 +1033,9 @@ void LLFolderViewItem::draw()
if(suffix_filter_length > 0)
{
S32 suffix_offset = llmax(0, filter_offset - (S32)mLabel.size());
- F32 match_string_left = text_left + font->getWidthF32(mLabel, 0, static_cast<S32>(mLabel.size())) + suffix_font->getWidthF32(mLabelSuffix, 0, suffix_offset + suffix_filter_length) - suffix_font->getWidthF32(mLabelSuffix, suffix_offset, suffix_filter_length);
+ F32 match_string_left = text_left + font->getWidthF32(mLabel.c_str(), 0, static_cast<S32>(mLabel.size())) + suffix_font->getWidthF32(mLabelSuffix.c_str(), 0, suffix_offset + suffix_filter_length) - suffix_font->getWidthF32(mLabelSuffix.c_str(), suffix_offset, suffix_filter_length);
F32 yy = (F32)getRect().getHeight() - suffix_font->getLineHeight() - (F32)mTextPad - (F32)TOP_PAD;
- suffix_font->renderUTF8(mLabelSuffix, suffix_offset, match_string_left, yy, sFilterTextColor,
+ suffix_font->render(mLabelSuffix, suffix_offset, match_string_left, yy, sFilterTextColor,
LLFontGL::LEFT, LLFontGL::BOTTOM, LLFontGL::NORMAL, LLFontGL::NO_SHADOW,
suffix_filter_length, S32_MAX, &right_x);
}
diff --git a/indra/llui/llfolderviewitem.h b/indra/llui/llfolderviewitem.h
index f7ced81274..60cdac3ab9 100644
--- a/indra/llui/llfolderviewitem.h
+++ b/indra/llui/llfolderviewitem.h
@@ -89,14 +89,14 @@ protected:
LLFolderViewItem(const Params& p);
- std::string mLabel;
+ LLWString mLabel;
S32 mLabelWidth;
bool mLabelWidthDirty;
S32 mLabelPaddingRight;
LLFolderViewFolder* mParentFolder;
LLPointer<LLFolderViewModelItem> mViewModelItem;
LLFontGL::StyleFlags mLabelStyle;
- std::string mLabelSuffix;
+ LLWString mLabelSuffix;
bool mSuffixNeedsRefresh; //suffix and icons
LLUIImagePtr mIcon,
mIconOpen,
@@ -242,7 +242,7 @@ public:
// This method returns the label displayed on the view. This
// method was primarily added to allow sorting on the folder
// contents possible before the entire view has been constructed.
- const std::string& getLabel() const { return mLabel; }
+ const LLWString& getLabel() const { return mLabel; }
LLFolderViewFolder* getParentFolder( void ) { return mParentFolder; }
const LLFolderViewFolder* getParentFolder( void ) const { return mParentFolder; }
diff --git a/indra/llui/lliconctrl.h b/indra/llui/lliconctrl.h
index aae1d1d572..29d3f0c3d4 100644
--- a/indra/llui/lliconctrl.h
+++ b/indra/llui/lliconctrl.h
@@ -79,7 +79,7 @@ public:
std::string getImageName() const;
- void setColor(const LLColor4& color) { mColor = color; }
+ void setColor(const LLUIColor& color) { mColor = color; }
void setImage(LLPointer<LLUIImage> image) { mImagep = image; }
const LLPointer<LLUIImage> getImage() { return mImagep; }
diff --git a/indra/llui/llkeywords.cpp b/indra/llui/llkeywords.cpp
index 5e184b5ddb..7bf43c22c1 100644
--- a/indra/llui/llkeywords.cpp
+++ b/indra/llui/llkeywords.cpp
@@ -85,7 +85,7 @@ LLKeywords::~LLKeywords()
// Add the token as described
void LLKeywords::addToken(LLKeywordToken::ETokenType type,
const std::string& key_in,
- const LLColor4& color,
+ const LLUIColor& color,
const std::string& tool_tip_in,
const std::string& delimiter_in)
{
@@ -164,13 +164,13 @@ std::string LLKeywords::getArguments(LLSD& arguments)
return argString;
}
-std::string LLKeywords::getAttribute(const std::string& key)
+std::string LLKeywords::getAttribute(std::string_view key)
{
attribute_iterator_t it = mAttributes.find(key);
return (it != mAttributes.end()) ? it->second : "";
}
-LLColor4 LLKeywords::getColorGroup(const std::string& key_in)
+LLUIColor LLKeywords::getColorGroup(std::string_view key_in)
{
std::string color_group = "ScriptText";
if (key_in == "functions")
@@ -261,12 +261,12 @@ void LLKeywords::processTokens()
LL_INFOS("SyntaxLSL") << "Finished processing tokens." << LL_ENDL;
}
-void LLKeywords::processTokensGroup(const LLSD& tokens, const std::string& group)
+void LLKeywords::processTokensGroup(const LLSD& tokens, std::string_view group)
{
- LLColor4 color;
- LLColor4 color_group;
- LLColor4 color_deprecated = getColorGroup("deprecated");
- LLColor4 color_god_mode = getColorGroup("god-mode");
+ LLUIColor color;
+ LLUIColor color_group;
+ LLUIColor color_deprecated = getColorGroup("deprecated");
+ LLUIColor color_god_mode = getColorGroup("god-mode");
LLKeywordToken::ETokenType token_type = LLKeywordToken::TT_UNKNOWN;
// If a new token type is added here, it must also be added to the 'addToken' method
@@ -296,7 +296,7 @@ void LLKeywords::processTokensGroup(const LLSD& tokens, const std::string& group
}
color_group = getColorGroup(group);
- LL_DEBUGS("SyntaxLSL") << "Group: '" << group << "', using color: '" << color_group << "'" << LL_ENDL;
+ LL_DEBUGS("SyntaxLSL") << "Group: '" << group << "', using color: '" << color_group.get() << "'" << LL_ENDL;
if (tokens.isMap())
{
@@ -333,7 +333,7 @@ void LLKeywords::processTokensGroup(const LLSD& tokens, const std::string& group
case LLKeywordToken::TT_CONSTANT:
if (getAttribute("type").length() > 0)
{
- color_group = getColorGroup(group + "-" + getAttribute("type"));
+ color_group = getColorGroup(std::string(group) + "-" + getAttribute("type"));
}
else
{
@@ -378,7 +378,7 @@ void LLKeywords::processTokensGroup(const LLSD& tokens, const std::string& group
}
else if (tokens.isArray()) // Currently nothing should need this, but it's here for completeness
{
- LL_INFOS("SyntaxLSL") << "Curious, shouldn't be an array here; adding all using color " << color << LL_ENDL;
+ LL_INFOS("SyntaxLSL") << "Curious, shouldn't be an array here; adding all using color " << color.get() << LL_ENDL;
for (S32 count = 0; count < tokens.size(); ++count)
{
addToken(token_type, tokens[count], color, "");
@@ -501,7 +501,7 @@ void LLKeywords::findSegments(std::vector<LLTextSegmentPtr>* seg_list, const LLW
{
if( *cur == '\n' )
{
- LLTextSegmentPtr text_segment = new LLLineBreakTextSegment(style, cur-base);
+ LLTextSegmentPtr text_segment = new LLLineBreakTextSegment(style, (S32)(cur - base));
text_segment->setToken( 0 );
insertSegment( *seg_list, text_segment, text_len, style, editor);
cur++;
@@ -532,13 +532,13 @@ void LLKeywords::findSegments(std::vector<LLTextSegmentPtr>* seg_list, const LLW
LLKeywordToken* cur_token = *iter;
if( cur_token->isHead( cur ) )
{
- S32 seg_start = cur - base;
+ S32 seg_start = (S32)(cur - base);
while( *cur && *cur != '\n' )
{
// skip the rest of the line
cur++;
}
- S32 seg_end = cur - base;
+ S32 seg_end = (S32)(cur - base);
//create segments from seg_start to seg_end
insertSegments(wtext, *seg_list,cur_token, text_len, seg_start, seg_end, style, editor);
@@ -582,7 +582,7 @@ void LLKeywords::findSegments(std::vector<LLTextSegmentPtr>* seg_list, const LLW
S32 between_delimiters = 0;
S32 seg_end = 0;
- seg_start = cur - base;
+ seg_start = (S32)(cur - base);
cur += cur_delimiter->getLengthHead();
LLKeywordToken::ETokenType type = cur_delimiter->getType();
@@ -669,7 +669,7 @@ void LLKeywords::findSegments(std::vector<LLTextSegmentPtr>* seg_list, const LLW
{
p++;
}
- S32 seg_len = p - cur;
+ S32 seg_len = (S32)(p - cur);
if( seg_len > 0 )
{
WStringMapIndex word( cur, seg_len );
@@ -677,7 +677,7 @@ void LLKeywords::findSegments(std::vector<LLTextSegmentPtr>* seg_list, const LLW
if( map_iter != mWordTokenMap.end() )
{
LLKeywordToken* cur_token = map_iter->second;
- S32 seg_start = cur - base;
+ S32 seg_start = (S32)(cur - base);
S32 seg_end = seg_start + seg_len;
// LL_INFOS("SyntaxLSL") << "Seg: [" << word.c_str() << "]" << LL_ENDL;
@@ -725,7 +725,7 @@ void LLKeywords::insertSegments(const LLWString& wtext, std::vector<LLTextSegmen
insertSegment( seg_list, text_segment, text_len, style, editor);
}
-void LLKeywords::insertSegment(std::vector<LLTextSegmentPtr>& seg_list, LLTextSegmentPtr new_segment, S32 text_len, const LLColor4 &defaultColor, LLTextEditor& editor )
+void LLKeywords::insertSegment(std::vector<LLTextSegmentPtr>& seg_list, LLTextSegmentPtr new_segment, S32 text_len, const LLUIColor& defaultColor, LLTextEditor& editor )
{
LLTextSegmentPtr last = seg_list.back();
S32 new_seg_end = new_segment->getEnd();
diff --git a/indra/llui/llkeywords.h b/indra/llui/llkeywords.h
index f498b3ddee..328561c92a 100644
--- a/indra/llui/llkeywords.h
+++ b/indra/llui/llkeywords.h
@@ -72,7 +72,7 @@ public:
TT_TYPE // WORD
} ETokenType;
- LLKeywordToken( ETokenType type, const LLColor4& color, const LLWString& token, const LLWString& tool_tip, const LLWString& delimiter )
+ LLKeywordToken( ETokenType type, const LLUIColor& color, const LLWString& token, const LLWString& tool_tip, const LLWString& delimiter )
:
mType( type ),
mToken( token ),
@@ -87,7 +87,7 @@ public:
bool isHead(const llwchar* s) const;
bool isTail(const llwchar* s) const;
const LLWString& getToken() const { return mToken; }
- const LLColor4& getColor() const { return mColor; }
+ const LLUIColor& getColor() const { return mColor; }
ETokenType getType() const { return mType; }
const LLWString& getToolTip() const { return mToolTip; }
const LLWString& getDelimiter() const { return mDelimiter; }
@@ -99,7 +99,7 @@ public:
private:
ETokenType mType;
LLWString mToken;
- LLColor4 mColor;
+ LLUIColor mColor;
LLWString mToolTip;
LLWString mDelimiter;
};
@@ -111,7 +111,7 @@ public:
~LLKeywords();
void clearLoaded() { mLoaded = false; }
- LLColor4 getColorGroup(const std::string& key_in);
+ LLUIColor getColorGroup(std::string_view key_in);
bool isLoaded() const { return mLoaded; }
void findSegments(std::vector<LLTextSegmentPtr> *seg_list,
@@ -124,7 +124,7 @@ public:
// Add the token as described
void addToken(LLKeywordToken::ETokenType type,
const std::string& key,
- const LLColor4& color,
+ const LLUIColor& color,
const std::string& tool_tip = LLStringUtil::null,
const std::string& delimiter = LLStringUtil::null);
@@ -153,7 +153,7 @@ public:
bool mOwner;
- LLColor4 mColor;
+ LLUIColor mColor;
};
typedef std::map<WStringMapIndex, LLKeywordToken*> word_token_map_t;
@@ -161,7 +161,7 @@ public:
keyword_iterator_t begin() const { return mWordTokenMap.begin(); }
keyword_iterator_t end() const { return mWordTokenMap.end(); }
- typedef std::map<WStringMapIndex, LLColor4> group_color_map_t;
+ typedef std::map<WStringMapIndex, LLUIColor> group_color_map_t;
typedef group_color_map_t::const_iterator color_iterator_t;
group_color_map_t mColorGroupMap;
@@ -170,11 +170,11 @@ public:
#endif
protected:
- void processTokensGroup(const LLSD& Tokens, const std::string& Group);
+ void processTokensGroup(const LLSD& Tokens, std::string_view Group);
void insertSegment(std::vector<LLTextSegmentPtr>& seg_list,
LLTextSegmentPtr new_segment,
S32 text_len,
- const LLColor4 &defaultColor,
+ const LLUIColor &defaultColor,
class LLTextEditor& editor);
void insertSegments(const LLWString& wtext,
std::vector<LLTextSegmentPtr>& seg_list,
@@ -194,10 +194,10 @@ protected:
token_list_t mLineTokenList;
token_list_t mDelimiterTokenList;
- typedef std::map<std::string, std::string> element_attributes_t;
+ typedef std::map<std::string, std::string, std::less<>> element_attributes_t;
typedef element_attributes_t::const_iterator attribute_iterator_t;
element_attributes_t mAttributes;
- std::string getAttribute(const std::string& key);
+ std::string getAttribute(std::string_view key);
std::string getArguments(LLSD& arguments);
};
diff --git a/indra/llui/lllayoutstack.cpp b/indra/llui/lllayoutstack.cpp
index 6db9f64a97..1c59938f90 100644
--- a/indra/llui/lllayoutstack.cpp
+++ b/indra/llui/lllayoutstack.cpp
@@ -86,10 +86,6 @@ void LLLayoutPanel::initFromParams(const Params& p)
LLLayoutPanel::~LLLayoutPanel()
{
- // probably not necessary, but...
- delete mResizeBar;
- mResizeBar = NULL;
-
gFocusMgr.removeKeyboardFocusWithoutCallback(this);
}
@@ -131,7 +127,7 @@ void LLLayoutPanel::setTargetDim(S32 value)
S32 LLLayoutPanel::getVisibleDim() const
{
- F32 min_dim = getRelevantMinDim();
+ F32 min_dim = (F32)getRelevantMinDim();
return ll_round(mVisibleAmt
* (min_dim
+ (((F32)mTargetDim - min_dim) * (1.f - mCollapseAmt))));
@@ -209,7 +205,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::getInstance()->mSettingGroups["config"], "UIResizeBarHeight", 0)),
+ border_size("border_size", LLUI::getInstance()->mSettingGroups["config"]->getS32("UIResizeBarHeight")),
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),
@@ -242,11 +238,9 @@ LLLayoutStack::LLLayoutStack(const LLLayoutStack::Params& p)
LLLayoutStack::~LLLayoutStack()
{
- e_panel_list_t panels = mPanels; // copy list of panel pointers
- mPanels.clear(); // clear so that removeChild() calls don't cause trouble
- std::for_each(panels.begin(), panels.end(), DeletePointer());
}
+// virtual
void LLLayoutStack::draw()
{
updateLayout();
@@ -284,8 +278,14 @@ void LLLayoutStack::draw()
}
}
+// virtual
void LLLayoutStack::deleteAllChildren()
{
+ for (LLLayoutPanel* p : mPanels)
+ {
+ p->mResizeBar = nullptr;
+ }
+
mPanels.clear();
LLView::deleteAllChildren();
@@ -295,29 +295,47 @@ void LLLayoutStack::deleteAllChildren()
mNeedsLayout = true;
}
+// virtual
void LLLayoutStack::removeChild(LLView* view)
{
- LLLayoutPanel* embedded_panelp = findEmbeddedPanel(dynamic_cast<LLPanel*>(view));
-
- if (embedded_panelp)
+ if (LLLayoutPanel* embedded_panelp = dynamic_cast<LLLayoutPanel*>(view))
{
- mPanels.erase(std::find(mPanels.begin(), mPanels.end(), embedded_panelp));
- LLView::removeChild(view);
- updateFractionalSizes();
- mNeedsLayout = true;
+ auto it = std::find(mPanels.begin(), mPanels.end(), embedded_panelp);
+ if (it != mPanels.end())
+ {
+ mPanels.erase(it);
+ }
+ if (embedded_panelp->mResizeBar)
+ {
+ LLView::removeChild(embedded_panelp->mResizeBar);
+ embedded_panelp->mResizeBar = nullptr;
+ }
}
- else
+ else if (LLResizeBar* resize_bar = dynamic_cast<LLResizeBar*>(view))
{
- LLView::removeChild(view);
+ for (LLLayoutPanel* p : mPanels)
+ {
+ if (p->mResizeBar == resize_bar)
+ {
+ p->mResizeBar = nullptr;
+ }
+ }
}
+
+ LLView::removeChild(view);
+
+ updateFractionalSizes();
+ mNeedsLayout = true;
}
+// virtual
bool LLLayoutStack::postBuild()
{
updateLayout();
return true;
}
+// virtual
bool LLLayoutStack::addChild(LLView* child, S32 tab_group)
{
LLLayoutPanel* panelp = dynamic_cast<LLLayoutPanel*>(child);
@@ -445,7 +463,7 @@ void LLLayoutStack::updateLayout()
for (LLLayoutPanel* panelp : mPanels)
{
- F32 panel_dim = llmax(panelp->getExpandedMinDim(), panelp->mTargetDim);
+ F32 panel_dim = (F32)llmax(panelp->getExpandedMinDim(), panelp->mTargetDim);
LLRect panel_rect;
if (mOrientation == HORIZONTAL)
@@ -465,7 +483,7 @@ void LLLayoutStack::updateLayout()
LLRect resize_bar_rect(panel_rect);
F32 panel_spacing = (F32)mPanelSpacing * panelp->getVisibleAmount();
- F32 panel_visible_dim = panelp->getVisibleDim();
+ F32 panel_visible_dim = (F32)panelp->getVisibleDim();
S32 panel_spacing_round = (S32)(ll_round(panel_spacing));
if (mOrientation == HORIZONTAL)
@@ -548,7 +566,7 @@ LLLayoutPanel* LLLayoutStack::findEmbeddedPanel(LLPanel* panelp) const
return NULL;
}
-LLLayoutPanel* LLLayoutStack::findEmbeddedPanelByName(const std::string& name) const
+LLLayoutPanel* LLLayoutStack::findEmbeddedPanelByName(std::string_view name) const
{
LLLayoutPanel* result = NULL;
@@ -983,6 +1001,7 @@ void LLLayoutStack::updatePanelRect( LLLayoutPanel* resized_panel, const LLRect&
//normalizeFractionalSizes();
}
+// virtual
void LLLayoutStack::reshape(S32 width, S32 height, bool called_from_parent)
{
mNeedsLayout = true;
diff --git a/indra/llui/lllayoutstack.h b/indra/llui/lllayoutstack.h
index 9e5f8048ba..8459921c60 100644
--- a/indra/llui/lllayoutstack.h
+++ b/indra/llui/lllayoutstack.h
@@ -111,7 +111,7 @@ private:
e_panel_list_t mPanels;
LLLayoutPanel* findEmbeddedPanel(LLPanel* panelp) const;
- LLLayoutPanel* findEmbeddedPanelByName(const std::string& name) const;
+ LLLayoutPanel* findEmbeddedPanelByName(std::string_view name) const;
void updateFractionalSizes();
void normalizeFractionalSizes();
void updatePanelRect( LLLayoutPanel* param1, const LLRect& new_rect );
diff --git a/indra/llui/lllineeditor.cpp b/indra/llui/lllineeditor.cpp
index fa71c7704d..ac7948f735 100644
--- a/indra/llui/lllineeditor.cpp
+++ b/indra/llui/lllineeditor.cpp
@@ -74,7 +74,7 @@ static LLDefaultChildRegistry::Register<LLLineEditor> r1("line_editor");
// Compiler optimization, generate extern template
template class LLLineEditor* LLView::getChild<class LLLineEditor>(
- const std::string& name, bool recurse) const;
+ std::string_view name, bool recurse) const;
//
// Member functions
@@ -2158,7 +2158,7 @@ void LLLineEditor::draw()
if (0 == mText.length() && (mReadOnly || mShowLabelFocused))
{
mGLFont->render(mLabel.getWString(), 0,
- mTextLeftEdge, (F32)text_bottom,
+ (F32)mTextLeftEdge, (F32)text_bottom,
label_color,
LLFontGL::LEFT,
LLFontGL::BOTTOM,
@@ -2183,7 +2183,7 @@ void LLLineEditor::draw()
if (0 == mText.length())
{
mGLFont->render(mLabel.getWString(), 0,
- mTextLeftEdge, (F32)text_bottom,
+ (F32)mTextLeftEdge, (F32)text_bottom,
label_color,
LLFontGL::LEFT,
LLFontGL::BOTTOM,
diff --git a/indra/llui/lllineeditor.h b/indra/llui/lllineeditor.h
index 2d9c3ac58a..3a39a7363d 100644
--- a/indra/llui/lllineeditor.h
+++ b/indra/llui/lllineeditor.h
@@ -205,7 +205,7 @@ public:
void setText(const LLStringExplicit &new_text);
const std::string& getText() const override { return mText.getString(); }
- LLWString getWText() const { return mText.getWString(); }
+ const LLWString& getWText() const { return mText.getWString(); }
LLWString getConvertedText() const; // trimmed text with paragraphs converted to newlines
S32 getLength() const { return mText.length(); }
@@ -225,12 +225,12 @@ public:
void setRevertOnEsc( bool b ) { mRevertOnEsc = b; }
void setKeystrokeOnEsc(bool b) { mKeystrokeOnEsc = b; }
- void setCursorColor(const LLColor4& c) { mCursorColor = c; }
+ void setCursorColor(const LLUIColor& c) { mCursorColor = c; }
const LLColor4& getCursorColor() const { return mCursorColor.get(); }
- void setFgColor( const LLColor4& c ) { mFgColor = c; }
- void setReadOnlyFgColor( const LLColor4& c ) { mReadOnlyFgColor = c; }
- void setTentativeFgColor(const LLColor4& c) { mTentativeFgColor = c; }
+ void setFgColor( const LLUIColor& c ) { mFgColor = c; }
+ void setReadOnlyFgColor( const LLUIColor& c ) { mReadOnlyFgColor = c; }
+ void setTentativeFgColor(const LLUIColor& c) { mTentativeFgColor = c; }
const LLColor4& getFgColor() const { return mFgColor.get(); }
const LLColor4& getReadOnlyFgColor() const { return mReadOnlyFgColor.get(); }
@@ -468,7 +468,7 @@ private:
// Build time optimization, generate once in .cpp file
#ifndef LLLINEEDITOR_CPP
extern template class LLLineEditor* LLView::getChild<class LLLineEditor>(
- const std::string& name, bool recurse) const;
+ std::string_view name, bool recurse) const;
#endif
#endif // LL_LINEEDITOR_
diff --git a/indra/llui/llmenugl.cpp b/indra/llui/llmenugl.cpp
index dffaf69a9f..69ffa9a94f 100644
--- a/indra/llui/llmenugl.cpp
+++ b/indra/llui/llmenugl.cpp
@@ -545,8 +545,8 @@ void LLMenuItemGL::draw( void )
std::string::size_type offset = upper_case_label.find(mJumpKey);
if (offset != std::string::npos)
{
- S32 x_begin = LEFT_PLAIN_PIXELS + mFont->getWidth(mLabel, 0, static_cast<S32>(offset));
- S32 x_end = LEFT_PLAIN_PIXELS + mFont->getWidth(mLabel, 0, static_cast<S32>(offset) + 1);
+ S32 x_begin = LEFT_PLAIN_PIXELS + mFont->getWidth(mLabel.getWString().c_str(), 0, static_cast<S32>(offset));
+ S32 x_end = LEFT_PLAIN_PIXELS + mFont->getWidth(mLabel.getWString().c_str(), 0, static_cast<S32>(offset) + 1);
gl_line_2d(x_begin, (MENU_ITEM_PADDING / 2) + 1, x_end, (MENU_ITEM_PADDING / 2) + 1);
}
}
@@ -988,7 +988,7 @@ LLMenuItemBranchGL::~LLMenuItemBranchGL()
// virtual
-LLView* LLMenuItemBranchGL::getChildView(const std::string& name, bool recurse) const
+LLView* LLMenuItemBranchGL::getChildView(std::string_view name, bool recurse) const
{
LLMenuGL* branch = getBranch();
if (branch)
@@ -1005,7 +1005,7 @@ LLView* LLMenuItemBranchGL::getChildView(const std::string& name, bool recurse)
return LLView::getChildView(name, recurse);
}
-LLView* LLMenuItemBranchGL::findChildView(const std::string& name, bool recurse) const
+LLView* LLMenuItemBranchGL::findChildView(std::string_view name, bool recurse) const
{
LLMenuGL* branch = getBranch();
if (branch)
@@ -1648,9 +1648,9 @@ void LLMenuItemBranchDownGL::draw( void )
std::string::size_type offset = upper_case_label.find(getJumpKey());
if (offset != std::string::npos)
{
- S32 x_offset = ll_round((F32)getRect().getWidth() / 2.f - getFont()->getWidthF32(mLabel.getString(), 0, S32_MAX) / 2.f);
- S32 x_begin = x_offset + getFont()->getWidth(mLabel, 0, static_cast<S32>(offset));
- S32 x_end = x_offset + getFont()->getWidth(mLabel, 0, static_cast<S32>(offset) + 1);
+ S32 x_offset = ll_round((F32)getRect().getWidth() / 2.f - getFont()->getWidthF32(mLabel.getWString().c_str(), 0, S32_MAX) / 2.f);
+ S32 x_begin = x_offset + getFont()->getWidth(mLabel.getWString().c_str(), 0, static_cast<S32>(offset));
+ S32 x_end = x_offset + getFont()->getWidth(mLabel.getWString().c_str(), 0, static_cast<S32>(offset) + 1);
gl_line_2d(x_begin, LABEL_BOTTOM_PAD_PIXELS, x_end, LABEL_BOTTOM_PAD_PIXELS);
}
}
@@ -2752,7 +2752,7 @@ void LLMenuGL::setEnabledSubMenus(bool enable)
// setItemEnabled() - pass the label and the enable flag for a menu
// item. true will make sure it's enabled, false will disable it.
-void LLMenuGL::setItemEnabled( const std::string& name, bool enable )
+void LLMenuGL::setItemEnabled(std::string_view name, bool enable )
{
item_list_t::iterator item_iter;
for (item_iter = mItems.begin(); item_iter != mItems.end(); ++item_iter)
@@ -2766,7 +2766,7 @@ void LLMenuGL::setItemEnabled( const std::string& name, bool enable )
}
}
-void LLMenuGL::setItemVisible( const std::string& name, bool visible )
+void LLMenuGL::setItemVisible(std::string_view name, bool visible )
{
item_list_t::iterator item_iter;
for (item_iter = mItems.begin(); item_iter != mItems.end(); ++item_iter)
@@ -3277,7 +3277,7 @@ void LLMenuGL::setVisible(bool visible)
}
}
-LLMenuGL* LLMenuGL::findChildMenuByName(const std::string& name, bool recurse) const
+LLMenuGL* LLMenuGL::findChildMenuByName(std::string_view name, bool recurse) const
{
LLView* view = findChildView(name, recurse);
if (view)
diff --git a/indra/llui/llmenugl.h b/indra/llui/llmenugl.h
index 51766afe85..66f84393fe 100644
--- a/indra/llui/llmenugl.h
+++ b/indra/llui/llmenugl.h
@@ -456,7 +456,7 @@ public:
virtual bool hasAccelerator(const KEY &key, const MASK &mask) const;
virtual bool handleAcceleratorKey(KEY key, MASK mask);
- LLMenuGL* findChildMenuByName(const std::string& name, bool recurse) const;
+ LLMenuGL* findChildMenuByName(std::string_view name, bool recurse) const;
bool clearHoverItem();
@@ -479,12 +479,12 @@ public:
// setItemEnabled() - pass the name and the enable flag for a
// menu item. true will make sure it's enabled, false will disable
// it.
- void setItemEnabled( const std::string& name, bool enable );
+ void setItemEnabled(std::string_view name, bool enable );
// propagate message to submenus
void setEnabledSubMenus(bool enable);
- void setItemVisible( const std::string& name, bool visible);
+ void setItemVisible(std::string_view name, bool visible);
void setItemLabel(const std::string &name, const std::string &label);
@@ -687,8 +687,8 @@ public:
virtual void openMenu();
- virtual LLView* getChildView(const std::string& name, bool recurse = true) const;
- virtual LLView* findChildView(const std::string& name, bool recurse = true) const;
+ virtual LLView* getChildView(std::string_view name, bool recurse = true) const;
+ virtual LLView* findChildView(std::string_view name, bool recurse = true) const;
private:
LLHandle<LLView> mBranchHandle;
diff --git a/indra/llui/llmultisliderctrl.cpp b/indra/llui/llmultisliderctrl.cpp
index 01e2fc6ac9..3235110662 100644
--- a/indra/llui/llmultisliderctrl.cpp
+++ b/indra/llui/llmultisliderctrl.cpp
@@ -245,7 +245,7 @@ bool LLMultiSliderCtrl::setLabelArg( const std::string& key, const LLStringExpli
res = mLabelBox->setTextArg(key, text);
if (res && mLabelWidth == 0)
{
- S32 label_width = mFont->getWidth(mLabelBox->getText());
+ S32 label_width = mFont->getWidth(mLabelBox->getWText().c_str());
LLRect rect = mLabelBox->getRect();
S32 prev_right = rect.mRight;
rect.mRight = rect.mLeft + label_width;
@@ -440,7 +440,7 @@ void LLMultiSliderCtrl::setEnabled(bool b)
if( mLabelBox )
{
- mLabelBox->setColor( b ? mTextEnabledColor.get() : mTextDisabledColor.get() );
+ mLabelBox->setColor( b ? mTextEnabledColor : mTextDisabledColor );
}
mMultiSlider->setEnabled( b );
@@ -452,7 +452,7 @@ void LLMultiSliderCtrl::setEnabled(bool b)
if( mTextBox )
{
- mTextBox->setColor( b ? mTextEnabledColor.get() : mTextDisabledColor.get() );
+ mTextBox->setColor( b ? mTextEnabledColor : mTextDisabledColor );
}
}
diff --git a/indra/llui/llmultisliderctrl.h b/indra/llui/llmultisliderctrl.h
index fee05c92fd..dec6cb48b9 100644
--- a/indra/llui/llmultisliderctrl.h
+++ b/indra/llui/llmultisliderctrl.h
@@ -130,8 +130,8 @@ public:
bool canAddSliders() { return mMultiSlider->canAddSliders(); }
void setLabel(const std::string& label) { if (mLabelBox) mLabelBox->setText(label); }
- void setLabelColor(const LLColor4& c) { mTextEnabledColor = c; }
- void setDisabledLabelColor(const LLColor4& c) { mTextDisabledColor = c; }
+ void setLabelColor(const LLUIColor& c) { mTextEnabledColor = c; }
+ void setDisabledLabelColor(const LLUIColor& c) { mTextDisabledColor = c; }
boost::signals2::connection setSliderMouseDownCallback( const commit_signal_t::slot_type& cb );
boost::signals2::connection setSliderMouseUpCallback( const commit_signal_t::slot_type& cb );
diff --git a/indra/llui/llnotifications.cpp b/indra/llui/llnotifications.cpp
index bee7d5bb3f..cd80e7f63f 100644
--- a/indra/llui/llnotifications.cpp
+++ b/indra/llui/llnotifications.cpp
@@ -266,7 +266,7 @@ LLSD LLNotificationForm::asLLSD() const
return mFormData;
}
-LLSD LLNotificationForm::getElement(const std::string& element_name)
+LLSD LLNotificationForm::getElement(std::string_view element_name)
{
for (LLSD::array_const_iterator it = mFormData.beginArray();
it != mFormData.endArray();
@@ -278,7 +278,7 @@ LLSD LLNotificationForm::getElement(const std::string& element_name)
}
-bool LLNotificationForm::hasElement(const std::string& element_name) const
+bool LLNotificationForm::hasElement(std::string_view element_name) const
{
for (LLSD::array_const_iterator it = mFormData.beginArray();
it != mFormData.endArray();
@@ -301,7 +301,7 @@ void LLNotificationForm::getElements(LLSD& elements, S32 offset)
}
}
-bool LLNotificationForm::getElementEnabled(const std::string& element_name) const
+bool LLNotificationForm::getElementEnabled(std::string_view element_name) const
{
for (LLSD::array_const_iterator it = mFormData.beginArray();
it != mFormData.endArray();
@@ -316,7 +316,7 @@ bool LLNotificationForm::getElementEnabled(const std::string& element_name) cons
return false;
}
-void LLNotificationForm::setElementEnabled(const std::string& element_name, bool enabled)
+void LLNotificationForm::setElementEnabled(std::string_view element_name, bool enabled)
{
for (LLSD::array_iterator it = mFormData.beginArray();
it != mFormData.endArray();
@@ -439,7 +439,7 @@ LLNotificationTemplate::LLNotificationTemplate(const LLNotificationTemplate::Par
mSoundName("")
{
if (p.sound.isProvided()
- && LLUI::getInstance()->mSettingGroups["config"]->controlExists(p.sound))
+ && LLUI::getInstance()->mSettingGroups["config"]->controlExists(p.sound()))
{
mSoundName = p.sound;
}
@@ -769,7 +769,7 @@ bool LLNotification::hasUniquenessConstraints() const
return (mTemplatep ? mTemplatep->mUnique : false);
}
-bool LLNotification::matchesTag(const std::string& tag)
+bool LLNotification::matchesTag(std::string_view tag)
{
bool result = false;
@@ -861,7 +861,7 @@ void LLNotification::init(const std::string& template_name, const LLSD& form_ele
for (LLStringUtil::format_map_t::const_iterator iter = default_args.begin();
iter != default_args.end(); ++iter)
{
- mSubstitutions[iter->first] = iter->second;
+ mSubstitutions[std::string(iter->first)] = iter->second;
}
mSubstitutions["_URL"] = getURL();
mSubstitutions["_NAME"] = template_name;
@@ -1443,11 +1443,12 @@ void LLNotifications::createDefaultChannels()
}
-LLNotificationTemplatePtr LLNotifications::getTemplate(const std::string& name)
+LLNotificationTemplatePtr LLNotifications::getTemplate(std::string_view name)
{
- if (mTemplates.count(name))
+ auto it = mTemplates.find(name);
+ if (it != mTemplates.end())
{
- return mTemplates[name];
+ return it->second;
}
else
{
@@ -1455,7 +1456,7 @@ LLNotificationTemplatePtr LLNotifications::getTemplate(const std::string& name)
}
}
-bool LLNotifications::templateExists(const std::string& name)
+bool LLNotifications::templateExists(std::string_view name)
{
return (mTemplates.count(name) != 0);
}
@@ -1740,7 +1741,7 @@ void LLNotifications::cancel(LLNotificationPtr pNotif)
}
}
-void LLNotifications::cancelByName(const std::string& name)
+void LLNotifications::cancelByName(std::string_view name)
{
LLMutexLock lock(&mItemsMutex);
std::vector<LLNotificationPtr> notifs_to_cancel;
@@ -1815,7 +1816,7 @@ LLNotificationPtr LLNotifications::find(LLUUID uuid)
}
}
-std::string LLNotifications::getGlobalString(const std::string& key) const
+std::string LLNotifications::getGlobalString(std::string_view key) const
{
GlobalStringMap::const_iterator it = mGlobalStrings.find(key);
if (it != mGlobalStrings.end())
@@ -1826,7 +1827,7 @@ std::string LLNotifications::getGlobalString(const std::string& key) const
{
// if we don't have the key as a global, return the key itself so that the error
// is self-diagnosing.
- return key;
+ return std::string(key);
}
}
@@ -1839,13 +1840,13 @@ bool LLNotifications::getIgnoreAllNotifications()
return mIgnoreAllNotifications;
}
-void LLNotifications::setIgnored(const std::string& name, bool ignored)
+void LLNotifications::setIgnored(std::string_view name, bool ignored)
{
LLNotificationTemplatePtr templatep = getTemplate(name);
templatep->mForm->setIgnored(ignored);
}
-bool LLNotifications::getIgnored(const std::string& name)
+bool LLNotifications::getIgnored(std::string_view name)
{
LLNotificationTemplatePtr templatep = getTemplate(name);
return (mIgnoreAllNotifications) || ( (templatep->mForm->getIgnoreType() != LLNotificationForm::IGNORE_NO) && (templatep->mForm->getIgnored()) );
diff --git a/indra/llui/llnotifications.h b/indra/llui/llnotifications.h
index d3615b6601..46286457cf 100644
--- a/indra/llui/llnotifications.h
+++ b/indra/llui/llnotifications.h
@@ -87,6 +87,7 @@
#include <boost/type_traits.hpp>
#include <boost/signals2.hpp>
#include <boost/range.hpp>
+#include <boost/intrusive_ptr.hpp>
#include "llevents.h"
#include "llfunctorregistry.h"
@@ -251,11 +252,11 @@ public:
S32 getNumElements() { return static_cast<S32>(mFormData.size()); }
LLSD getElement(S32 index) { return mFormData.get(index); }
- LLSD getElement(const std::string& element_name);
+ LLSD getElement(std::string_view element_name);
void getElements(LLSD& elements, S32 offset = 0);
- bool hasElement(const std::string& element_name) const;
- bool getElementEnabled(const std::string& element_name) const;
- void setElementEnabled(const std::string& element_name, bool enabled);
+ bool hasElement(std::string_view element_name) const;
+ bool getElementEnabled(std::string_view element_name) const;
+ void setElementEnabled(std::string_view element_name, bool enabled);
void addElement(const std::string& type, const std::string& name, const LLSD& value = LLSD(), bool enabled = true);
void formatElements(const LLSD& substitutions);
// appends form elements from another form serialized as LLSD
@@ -641,7 +642,7 @@ public:
bool hasUniquenessConstraints() const;
- bool matchesTag(const std::string& tag);
+ bool matchesTag(std::string_view tag);
virtual ~LLNotification() {}
};
@@ -926,7 +927,7 @@ public:
void add(const LLNotificationPtr pNotif);
void load(const LLNotificationPtr pNotif);
void cancel(LLNotificationPtr pNotif);
- void cancelByName(const std::string& name);
+ void cancelByName(std::string_view name);
void cancelByOwner(const LLUUID ownerId);
void update(const LLNotificationPtr pNotif);
@@ -934,19 +935,19 @@ public:
// This is all stuff for managing the templates
// take your template out
- LLNotificationTemplatePtr getTemplate(const std::string& name);
+ LLNotificationTemplatePtr getTemplate(std::string_view name);
// get the whole collection
typedef std::vector<std::string> TemplateNames;
TemplateNames getTemplateNames() const; // returns a list of notification names
- typedef std::map<std::string, LLNotificationTemplatePtr> TemplateMap;
+ typedef std::map<std::string, LLNotificationTemplatePtr, std::less<>> TemplateMap;
TemplateMap::const_iterator templatesBegin() { return mTemplates.begin(); }
TemplateMap::const_iterator templatesEnd() { return mTemplates.end(); }
// test for existence
- bool templateExists(const std::string& name);
+ bool templateExists(std::string_view name);
typedef std::list<LLNotificationVisibilityRulePtr> VisibilityRuleList;
@@ -956,13 +957,13 @@ public:
LLNotificationChannelPtr getChannel(const std::string& channelName);
- std::string getGlobalString(const std::string& key) const;
+ std::string getGlobalString(std::string_view key) const;
void setIgnoreAllNotifications(bool ignore);
bool getIgnoreAllNotifications();
- void setIgnored(const std::string& name, bool ignored);
- bool getIgnored(const std::string& name);
+ void setIgnored(std::string_view name, bool ignored);
+ bool getIgnored(std::string_view name);
bool isVisibleByRules(LLNotificationPtr pNotification);
@@ -988,7 +989,7 @@ private:
LLNotificationMap mUniqueNotifications;
- typedef std::map<std::string, std::string> GlobalStringMap;
+ typedef std::map<std::string, std::string, std::less<>> GlobalStringMap;
GlobalStringMap mGlobalStrings;
bool mIgnoreAllNotifications;
diff --git a/indra/llui/llnotificationslistener.cpp b/indra/llui/llnotificationslistener.cpp
index ace9e37e25..9c1fc27c51 100644
--- a/indra/llui/llnotificationslistener.cpp
+++ b/indra/llui/llnotificationslistener.cpp
@@ -191,7 +191,7 @@ void LLNotificationsListener::ignore(const LLSD& params) const
if (params["name"].isDefined())
{
// ["name"] was passed: ignore just that notification
- LLNotificationTemplatePtr templatep = mNotifications.getTemplate(params["name"]);
+ LLNotificationTemplatePtr templatep = mNotifications.getTemplate(params["name"].asStringRef());
if (templatep)
{
templatep->mForm->setIgnored(ignore);
diff --git a/indra/llui/llpanel.cpp b/indra/llui/llpanel.cpp
index 468cdb10fb..8e96bdde80 100644
--- a/indra/llui/llpanel.cpp
+++ b/indra/llui/llpanel.cpp
@@ -55,7 +55,7 @@ LLPanel::factory_stack_t LLPanel::sFactoryStack;
// Compiler optimization, generate extern template
template class LLPanel* LLView::getChild<class LLPanel>(
- const std::string& name, bool recurse) const;
+ std::string_view name, bool recurse) const;
LLPanel::LocalizedString::LocalizedString()
: name("name"),
@@ -277,7 +277,7 @@ void LLPanel::setDefaultBtn(LLButton* btn)
}
}
-void LLPanel::setDefaultBtn(const std::string& id)
+void LLPanel::setDefaultBtn(std::string_view id)
{
LLButton *button = getChild<LLButton>(id);
if (button)
@@ -490,8 +490,8 @@ void LLPanel::initFromParams(const LLPanel::Params& p)
setBackgroundVisible(p.background_visible);
setBackgroundOpaque(p.background_opaque);
- setBackgroundColor(p.bg_opaque_color().get());
- setTransparentColor(p.bg_alpha_color().get());
+ setBackgroundColor(p.bg_opaque_color);
+ setTransparentColor(p.bg_alpha_color);
mBgOpaqueImage = p.bg_opaque_image();
mBgAlphaImage = p.bg_alpha_image();
mBgOpaqueImageOverlay = p.bg_opaque_image_overlay;
@@ -593,12 +593,12 @@ bool LLPanel::initPanelXML(LLXMLNodePtr node, LLView *parent, LLXMLNodePtr outpu
return true;
}
-bool LLPanel::hasString(const std::string& name)
+bool LLPanel::hasString(std::string_view name)
{
return mUIStrings.find(name) != mUIStrings.end();
}
-std::string LLPanel::getString(const std::string& name, const LLStringUtil::format_map_t& args) const
+std::string LLPanel::getString(std::string_view name, const LLStringUtil::format_map_t& args) const
{
ui_string_map_t::const_iterator found_it = mUIStrings.find(name);
if (found_it != mUIStrings.end())
@@ -608,7 +608,7 @@ std::string LLPanel::getString(const std::string& name, const LLStringUtil::form
formatted_string.setArgList(args);
return formatted_string.getString();
}
- std::string err_str("Failed to find string " + name + " in panel " + getName()); //*TODO: Translate
+ std::string err_str("Failed to find string " + std::string(name) + " in panel " + getName()); //*TODO: Translate
if(LLUI::getInstance()->mSettingGroups["config"]->getBOOL("QAMode"))
{
LL_ERRS() << err_str << LL_ENDL;
@@ -620,14 +620,14 @@ std::string LLPanel::getString(const std::string& name, const LLStringUtil::form
return LLStringUtil::null;
}
-std::string LLPanel::getString(const std::string& name) const
+std::string LLPanel::getString(std::string_view name) const
{
ui_string_map_t::const_iterator found_it = mUIStrings.find(name);
if (found_it != mUIStrings.end())
{
return found_it->second;
}
- std::string err_str("Failed to find string " + name + " in panel " + getName()); //*TODO: Translate
+ std::string err_str("Failed to find string " + std::string(name) +" in panel " + getName()); //*TODO: Translate
if(LLUI::getInstance()->mSettingGroups["config"]->getBOOL("QAMode"))
{
LL_ERRS() << err_str << LL_ENDL;
@@ -640,7 +640,7 @@ std::string LLPanel::getString(const std::string& name) const
}
-void LLPanel::childSetVisible(const std::string& id, bool visible)
+void LLPanel::childSetVisible(std::string_view id, bool visible)
{
LLView* child = findChild<LLView>(id);
if (child)
@@ -649,7 +649,7 @@ void LLPanel::childSetVisible(const std::string& id, bool visible)
}
}
-void LLPanel::childSetEnabled(const std::string& id, bool enabled)
+void LLPanel::childSetEnabled(std::string_view id, bool enabled)
{
LLView* child = findChild<LLView>(id);
if (child)
@@ -658,7 +658,7 @@ void LLPanel::childSetEnabled(const std::string& id, bool enabled)
}
}
-void LLPanel::childSetFocus(const std::string& id, bool focus)
+void LLPanel::childSetFocus(std::string_view id, bool focus)
{
LLUICtrl* child = findChild<LLUICtrl>(id);
if (child)
@@ -667,7 +667,7 @@ void LLPanel::childSetFocus(const std::string& id, bool focus)
}
}
-bool LLPanel::childHasFocus(const std::string& id)
+bool LLPanel::childHasFocus(std::string_view id)
{
LLUICtrl* child = findChild<LLUICtrl>(id);
if (child)
@@ -684,7 +684,7 @@ bool LLPanel::childHasFocus(const std::string& id)
// Prefer getChild<LLUICtrl>("foo")->setCommitCallback(boost:bind(...)),
// which takes a generic slot. Or use mCommitCallbackRegistrar.add() with
// a named callback and reference it in XML.
-void LLPanel::childSetCommitCallback(const std::string& id, boost::function<void (LLUICtrl*,void*)> cb, void* data)
+void LLPanel::childSetCommitCallback(std::string_view id, boost::function<void (LLUICtrl*,void*)> cb, void* data)
{
LLUICtrl* child = findChild<LLUICtrl>(id);
if (child)
@@ -693,7 +693,7 @@ void LLPanel::childSetCommitCallback(const std::string& id, boost::function<void
}
}
-void LLPanel::childSetColor(const std::string& id, const LLColor4& color)
+void LLPanel::childSetColor(std::string_view id, const LLUIColor& color)
{
LLUICtrl* child = findChild<LLUICtrl>(id);
if (child)
@@ -702,7 +702,7 @@ void LLPanel::childSetColor(const std::string& id, const LLColor4& color)
}
}
-LLCtrlSelectionInterface* LLPanel::childGetSelectionInterface(const std::string& id) const
+LLCtrlSelectionInterface* LLPanel::childGetSelectionInterface(std::string_view id) const
{
LLUICtrl* child = findChild<LLUICtrl>(id);
if (child)
@@ -712,7 +712,7 @@ LLCtrlSelectionInterface* LLPanel::childGetSelectionInterface(const std::string&
return NULL;
}
-LLCtrlListInterface* LLPanel::childGetListInterface(const std::string& id) const
+LLCtrlListInterface* LLPanel::childGetListInterface(std::string_view id) const
{
LLUICtrl* child = findChild<LLUICtrl>(id);
if (child)
@@ -722,7 +722,7 @@ LLCtrlListInterface* LLPanel::childGetListInterface(const std::string& id) const
return NULL;
}
-LLCtrlScrollInterface* LLPanel::childGetScrollInterface(const std::string& id) const
+LLCtrlScrollInterface* LLPanel::childGetScrollInterface(std::string_view id) const
{
LLUICtrl* child = findChild<LLUICtrl>(id);
if (child)
@@ -732,7 +732,7 @@ LLCtrlScrollInterface* LLPanel::childGetScrollInterface(const std::string& id) c
return NULL;
}
-void LLPanel::childSetValue(const std::string& id, LLSD value)
+void LLPanel::childSetValue(std::string_view id, LLSD value)
{
LLUICtrl* child = findChild<LLUICtrl>(id);
if (child)
@@ -741,7 +741,7 @@ void LLPanel::childSetValue(const std::string& id, LLSD value)
}
}
-LLSD LLPanel::childGetValue(const std::string& id) const
+LLSD LLPanel::childGetValue(std::string_view id) const
{
LLUICtrl* child = findChild<LLUICtrl>(id);
if (child)
@@ -752,7 +752,7 @@ LLSD LLPanel::childGetValue(const std::string& id) const
return LLSD();
}
-bool LLPanel::childSetTextArg(const std::string& id, const std::string& key, const LLStringExplicit& text)
+bool LLPanel::childSetTextArg(std::string_view id, const std::string& key, const LLStringExplicit& text)
{
LLUICtrl* child = findChild<LLUICtrl>(id);
if (child)
@@ -762,7 +762,7 @@ bool LLPanel::childSetTextArg(const std::string& id, const std::string& key, con
return false;
}
-bool LLPanel::childSetLabelArg(const std::string& id, const std::string& key, const LLStringExplicit& text)
+bool LLPanel::childSetLabelArg(std::string_view id, const std::string& key, const LLStringExplicit& text)
{
LLView* child = findChild<LLView>(id);
if (child)
@@ -772,7 +772,7 @@ bool LLPanel::childSetLabelArg(const std::string& id, const std::string& key, co
return false;
}
-void LLPanel::childSetAction(const std::string& id, const commit_signal_t::slot_type& function)
+void LLPanel::childSetAction(std::string_view id, const commit_signal_t::slot_type& function)
{
LLButton* button = findChild<LLButton>(id);
if (button)
@@ -781,7 +781,7 @@ void LLPanel::childSetAction(const std::string& id, const commit_signal_t::slot_
}
}
-void LLPanel::childSetAction(const std::string& id, boost::function<void(void*)> function, void* value)
+void LLPanel::childSetAction(std::string_view id, boost::function<void(void*)> function, void* value)
{
LLButton* button = findChild<LLButton>(id);
if (button)
diff --git a/indra/llui/llpanel.h b/indra/llui/llpanel.h
index 2be5573faf..f085c123c1 100644
--- a/indra/llui/llpanel.h
+++ b/indra/llui/llpanel.h
@@ -134,22 +134,22 @@ public:
bool hasBorder() const { return mBorder != NULL; }
void setBorderVisible( bool b );
- void setBackgroundColor( const LLColor4& color ) { mBgOpaqueColor = color; }
+ void setBackgroundColor( const LLUIColor& color ) { mBgOpaqueColor = color; }
const LLColor4& getBackgroundColor() const { return mBgOpaqueColor; }
- void setTransparentColor(const LLColor4& color) { mBgAlphaColor = color; }
+ void setTransparentColor(const LLUIColor& color) { mBgAlphaColor = color; }
const LLColor4& getTransparentColor() const { return mBgAlphaColor; }
void setBackgroundImage(LLUIImage* image) { mBgOpaqueImage = image; }
void setTransparentImage(LLUIImage* image) { mBgAlphaImage = image; }
LLPointer<LLUIImage> getBackgroundImage() const { return mBgOpaqueImage; }
LLPointer<LLUIImage> getTransparentImage() const { return mBgAlphaImage; }
- LLColor4 getBackgroundImageOverlay() { return mBgOpaqueImageOverlay; }
- LLColor4 getTransparentImageOverlay() { return mBgAlphaImageOverlay; }
+ const LLColor4& getBackgroundImageOverlay() { return mBgOpaqueImageOverlay; }
+ const LLColor4& getTransparentImageOverlay() { return mBgAlphaImageOverlay; }
void setBackgroundVisible( bool b ) { mBgVisible = b; }
bool isBackgroundVisible() const { return mBgVisible; }
void setBackgroundOpaque(bool b) { mBgOpaque = b; }
bool isBackgroundOpaque() const { return mBgOpaque; }
void setDefaultBtn(LLButton* btn = NULL);
- void setDefaultBtn(const std::string& id);
+ void setDefaultBtn(std::string_view id);
void updateDefaultBtn();
void setLabel(const LLStringExplicit& label) { mLabel = label; }
std::string getLabel() const { return mLabel; }
@@ -169,47 +169,47 @@ public:
void initFromParams(const Params& p);
bool initPanelXML( LLXMLNodePtr node, LLView *parent, LLXMLNodePtr output_node, const LLPanel::Params& default_params);
- bool hasString(const std::string& name);
- std::string getString(const std::string& name, const LLStringUtil::format_map_t& args) const;
- std::string getString(const std::string& name) const;
+ bool hasString(std::string_view name);
+ std::string getString(std::string_view name, const LLStringUtil::format_map_t& args) const;
+ std::string getString(std::string_view name) const;
// ** Wrappers for setting child properties by name ** -TomY
// WARNING: These are deprecated, please use getChild<T>("name")->doStuff() idiom instead
// LLView
- void childSetVisible(const std::string& name, bool visible);
+ void childSetVisible(std::string_view name, bool visible);
- void childSetEnabled(const std::string& name, bool enabled);
- void childEnable(const std::string& name) { childSetEnabled(name, true); }
- void childDisable(const std::string& name) { childSetEnabled(name, false); };
+ void childSetEnabled(std::string_view name, bool enabled);
+ void childEnable(std::string_view name) { childSetEnabled(name, true); }
+ void childDisable(std::string_view name) { childSetEnabled(name, false); };
// LLUICtrl
- void childSetFocus(const std::string& id, bool focus = true);
- bool childHasFocus(const std::string& id);
+ void childSetFocus(std::string_view id, bool focus = true);
+ bool childHasFocus(std::string_view id);
// *TODO: Deprecate; for backwards compatability only:
// Prefer getChild<LLUICtrl>("foo")->setCommitCallback(boost:bind(...)),
// which takes a generic slot. Or use mCommitCallbackRegistrar.add() with
// a named callback and reference it in XML.
- void childSetCommitCallback(const std::string& id, boost::function<void (LLUICtrl*,void*)> cb, void* data);
- void childSetColor(const std::string& id, const LLColor4& color);
+ void childSetCommitCallback(std::string_view id, boost::function<void (LLUICtrl*,void*)> cb, void* data);
+ void childSetColor(std::string_view id, const LLUIColor& color);
- LLCtrlSelectionInterface* childGetSelectionInterface(const std::string& id) const;
- LLCtrlListInterface* childGetListInterface(const std::string& id) const;
- LLCtrlScrollInterface* childGetScrollInterface(const std::string& id) const;
+ LLCtrlSelectionInterface* childGetSelectionInterface(std::string_view id) const;
+ LLCtrlListInterface* childGetListInterface(std::string_view id) const;
+ LLCtrlScrollInterface* childGetScrollInterface(std::string_view id) const;
// This is the magic bullet for data-driven UI
- void childSetValue(const std::string& id, LLSD value);
- LLSD childGetValue(const std::string& id) const;
+ void childSetValue(std::string_view id, LLSD value);
+ LLSD childGetValue(std::string_view id) const;
// For setting text / label replacement params, e.g. "Hello [NAME]"
// Not implemented for all types, defaults to noop, returns false if not applicaple
- bool childSetTextArg(const std::string& id, const std::string& key, const LLStringExplicit& text);
- bool childSetLabelArg(const std::string& id, const std::string& key, const LLStringExplicit& text);
+ bool childSetTextArg(std::string_view id, const std::string& key, const LLStringExplicit& text);
+ bool childSetLabelArg(std::string_view id, const std::string& key, const LLStringExplicit& text);
// LLButton
- void childSetAction(const std::string& id, boost::function<void(void*)> function, void* value);
- void childSetAction(const std::string& id, const commit_signal_t::slot_type& function);
+ void childSetAction(std::string_view id, boost::function<void(void*)> function, void* value);
+ void childSetAction(std::string_view id, const commit_signal_t::slot_type& function);
static LLView* fromXML(LLXMLNodePtr node, LLView *parent, LLXMLNodePtr output_node = NULL);
@@ -250,7 +250,7 @@ private:
LLButton* mDefaultBtn;
LLUIString mLabel;
- typedef std::map<std::string, std::string> ui_string_map_t;
+ typedef std::map<std::string, std::string, std::less<>> ui_string_map_t;
ui_string_map_t mUIStrings;
@@ -259,7 +259,7 @@ private:
// Build time optimization, generate once in .cpp file
#ifndef LLPANEL_CPP
extern template class LLPanel* LLView::getChild<class LLPanel>(
- const std::string& name, bool recurse) const;
+ std::string_view name, bool recurse) const;
#endif
typedef boost::function<LLPanel* (void)> LLPanelClassCreatorFunc;
@@ -277,7 +277,7 @@ public:
mPanelClassesNames[tag] = func;
}
- LLPanel* createPanelClass(const std::string& tag)
+ LLPanel* createPanelClass(std::string_view tag)
{
param_name_map_t::iterator iT = mPanelClassesNames.find(tag);
if(iT == mPanelClassesNames.end())
@@ -292,7 +292,7 @@ public:
}
private:
- typedef std::map< std::string, LLPanelClassCreatorFunc> param_name_map_t;
+ typedef std::map< std::string, LLPanelClassCreatorFunc, std::less<>> param_name_map_t;
param_name_map_t mPanelClassesNames;
};
diff --git a/indra/llui/llscrollbar.cpp b/indra/llui/llscrollbar.cpp
index 9c73b1ba3f..d0eec387bd 100644
--- a/indra/llui/llscrollbar.cpp
+++ b/indra/llui/llscrollbar.cpp
@@ -113,7 +113,8 @@ LLScrollbar::LLScrollbar(const Params & p)
up_btn.tab_stop(false);
up_btn.follows.flags = (mOrientation == VERTICAL ? (FOLLOWS_RIGHT | FOLLOWS_TOP) : (FOLLOWS_LEFT | FOLLOWS_BOTTOM));
- addChild(LLUICtrlFactory::create<LLButton>(up_btn));
+ mLineUpBtn = LLUICtrlFactory::create<LLButton>(up_btn);
+ addChild(mLineUpBtn);
LLButton::Params down_btn(mOrientation == VERTICAL ? p.down_button : p.right_button);
down_btn.name(std::string("Line Down"));
@@ -123,7 +124,8 @@ LLScrollbar::LLScrollbar(const Params & p)
down_btn.mouse_held_callback.function(boost::bind(&LLScrollbar::onLineDownBtnPressed, this, _2));
down_btn.tab_stop(false);
- addChild(LLUICtrlFactory::create<LLButton>(down_btn));
+ mLineDownBtn = LLUICtrlFactory::create<LLButton>(down_btn);
+ addChild(mLineDownBtn);
}
@@ -468,22 +470,20 @@ void LLScrollbar::reshape(S32 width, S32 height, bool called_from_parent)
{
if (width == getRect().getWidth() && height == getRect().getHeight()) return;
LLView::reshape( width, height, called_from_parent );
- LLButton* up_button = getChild<LLButton>("Line Up");
- LLButton* down_button = getChild<LLButton>("Line Down");
if (mOrientation == VERTICAL)
{
- up_button->reshape(up_button->getRect().getWidth(), llmin(getRect().getHeight() / 2, mThickness));
- down_button->reshape(down_button->getRect().getWidth(), llmin(getRect().getHeight() / 2, mThickness));
- up_button->setOrigin(0, getRect().getHeight() - up_button->getRect().getHeight());
- down_button->setOrigin(0, 0);
+ mLineUpBtn->reshape(mLineUpBtn->getRect().getWidth(), llmin(getRect().getHeight() / 2, mThickness));
+ mLineDownBtn->reshape(mLineDownBtn->getRect().getWidth(), llmin(getRect().getHeight() / 2, mThickness));
+ mLineUpBtn->setOrigin(0, getRect().getHeight() - mLineUpBtn->getRect().getHeight());
+ mLineDownBtn->setOrigin(0, 0);
}
else
{
- up_button->reshape(llmin(getRect().getWidth() / 2, mThickness), up_button->getRect().getHeight());
- down_button->reshape(llmin(getRect().getWidth() / 2, mThickness), down_button->getRect().getHeight());
- up_button->setOrigin(0, 0);
- down_button->setOrigin(getRect().getWidth() - down_button->getRect().getWidth(), 0);
+ mLineUpBtn->reshape(llmin(getRect().getWidth() / 2, mThickness), mLineUpBtn->getRect().getHeight());
+ mLineDownBtn->reshape(llmin(getRect().getWidth() / 2, mThickness), mLineDownBtn->getRect().getHeight());
+ mLineUpBtn->setOrigin(0, 0);
+ mLineDownBtn->setOrigin(getRect().getWidth() - mLineDownBtn->getRect().getWidth(), 0);
}
updateThumbRect();
}
diff --git a/indra/llui/llscrollbar.h b/indra/llui/llscrollbar.h
index 7b935aa51b..9607355a9d 100644
--- a/indra/llui/llscrollbar.h
+++ b/indra/llui/llscrollbar.h
@@ -161,6 +161,9 @@ private:
LLUIImagePtr mTrackImageH;
S32 mThickness;
+
+ LLButton* mLineUpBtn = nullptr;
+ LLButton* mLineDownBtn = nullptr;
};
diff --git a/indra/llui/llscrollingpanellist.cpp b/indra/llui/llscrollingpanellist.cpp
index b158d7b1b7..7696a27320 100644
--- a/indra/llui/llscrollingpanellist.cpp
+++ b/indra/llui/llscrollingpanellist.cpp
@@ -84,42 +84,35 @@ void LLScrollingPanelList::removePanel(LLScrollingPanel* panel)
if (!mPanelList.empty())
{
- for (iter = mPanelList.begin(); iter != mPanelList.end(); ++iter, ++index)
- {
- if (*iter == panel)
- {
- break;
- }
- }
+ LLScrollingPanelList::panel_list_t::const_iterator iter =
+ std::find(mPanelList.begin(), mPanelList.end(), panel);
if (iter != mPanelList.end())
{
- removePanel(index);
+ removeChild(panel);
+ mPanelList.erase(iter);
+ rearrange();
}
}
}
-void LLScrollingPanelList::removePanel( U32 panel_index )
+void LLScrollingPanelList::removePanel(U32 panel_index)
{
- if ( mPanelList.empty() || panel_index >= mPanelList.size() )
+ if (panel_index >= mPanelList.size())
{
LL_WARNS() << "Panel index " << panel_index << " is out of range!" << LL_ENDL;
return;
}
- else
- {
- removeChild( mPanelList.at(panel_index) );
- mPanelList.erase( mPanelList.begin() + panel_index );
- }
+ LLScrollingPanelList::panel_list_t::const_iterator iter = mPanelList.begin() + panel_index;
+ removeChild(*iter);
+ mPanelList.erase(iter);
rearrange();
}
void LLScrollingPanelList::updatePanels(bool allow_modify)
{
- for (std::deque<LLScrollingPanel*>::iterator iter = mPanelList.begin();
- iter != mPanelList.end(); ++iter)
+ for (LLScrollingPanel* childp : mPanelList)
{
- LLScrollingPanel *childp = *iter;
childp->updatePanel(allow_modify);
}
}
@@ -131,10 +124,8 @@ void LLScrollingPanelList::rearrange()
if (!mPanelList.empty())
{
new_width = new_height = mPadding * 2;
- for (std::deque<LLScrollingPanel*>::iterator iter = mPanelList.begin();
- iter != mPanelList.end(); ++iter)
+ for (LLScrollingPanel* childp : mPanelList)
{
- LLScrollingPanel* childp = *iter;
const LLRect& rect = childp->getRect();
if (mIsHorizontal)
{
@@ -180,10 +171,8 @@ void LLScrollingPanelList::rearrange()
// Reposition each of the child views
S32 pos = mIsHorizontal ? mPadding : rc.getHeight() - mPadding;
- for (std::deque<LLScrollingPanel*>::iterator iter = mPanelList.begin();
- iter != mPanelList.end(); ++iter)
+ for (LLScrollingPanel* childp : mPanelList)
{
- LLScrollingPanel* childp = *iter;
const LLRect& rect = childp->getRect();
if (mIsHorizontal)
{
@@ -211,10 +200,11 @@ void LLScrollingPanelList::updatePanelVisiblilty()
getParent()->getRect().getHeight() - mPadding,
&parent_screen_rect.mRight, &parent_screen_rect.mTop );
- for (std::deque<LLScrollingPanel*>::iterator iter = mPanelList.begin();
- iter != mPanelList.end(); ++iter)
+ for (LLScrollingPanel* childp : mPanelList)
{
- LLScrollingPanel *childp = *iter;
+ if (childp->isDead())
+ continue;
+
const LLRect& local_rect = childp->getRect();
LLRect screen_rect;
childp->localPointToScreen(
diff --git a/indra/llui/llscrolllistcell.cpp b/indra/llui/llscrolllistcell.cpp
index 403879646d..7ef2e54429 100644
--- a/indra/llui/llscrolllistcell.cpp
+++ b/indra/llui/llscrolllistcell.cpp
@@ -209,7 +209,7 @@ void LLScrollListBar::setValue(const LLSD& value)
{
if (value.has("ratio"))
{
- mRatio = value["ratio"].asReal();
+ mRatio = (F32)value["ratio"].asReal();
}
if (value.has("bottom"))
{
@@ -239,7 +239,7 @@ S32 LLScrollListBar::getWidth() const
void LLScrollListBar::draw(const LLColor4& color, const LLColor4& highlight_color) const
{
S32 bar_width = getWidth() - mLeftPad - mRightPad;
- S32 left = bar_width - bar_width * mRatio;
+ S32 left = (S32)(bar_width - bar_width * mRatio);
left = llclamp(left, mLeftPad, getWidth() - mRightPad - 1);
gl_rect_2d(left, mBottom, getWidth() - mRightPad, mBottom - 1, mColor);
@@ -305,7 +305,7 @@ bool LLScrollListText::needsToolTip() const
return LLScrollListCell::needsToolTip();
// ...otherwise, show tooltips for truncated text
- return mFont->getWidth(mText.getString()) > getWidth();
+ return mFont->getWidth(mText.getWString().c_str()) > getWidth();
}
//virtual
@@ -328,7 +328,7 @@ LLScrollListText::~LLScrollListText()
S32 LLScrollListText::getContentWidth() const
{
- return mFont->getWidth(mText.getString());
+ return mFont->getWidth(mText.getWString().c_str());
}
@@ -394,18 +394,18 @@ void LLScrollListText::draw(const LLColor4& color, const LLColor4& highlight_col
switch(mFontAlignment)
{
case LLFontGL::LEFT:
- left = mFont->getWidth(mText.getString(), 1, mHighlightOffset);
+ left = mFont->getWidth(mText.getWString().c_str(), 1, mHighlightOffset);
break;
case LLFontGL::RIGHT:
- left = getWidth() - mFont->getWidth(mText.getString(), mHighlightOffset, S32_MAX);
+ left = getWidth() - mFont->getWidth(mText.getWString().c_str(), mHighlightOffset, S32_MAX);
break;
case LLFontGL::HCENTER:
- left = (getWidth() - mFont->getWidth(mText.getString())) / 2;
+ left = (getWidth() - mFont->getWidth(mText.getWString().c_str())) / 2;
break;
}
LLRect highlight_rect(left - 2,
mFont->getLineHeight() + 1,
- left + mFont->getWidth(mText.getString(), mHighlightOffset, mHighlightCount) + 1,
+ left + mFont->getWidth(mText.getWString().c_str(), mHighlightOffset, mHighlightCount) + 1,
1);
mRoundedRectImage->draw(highlight_rect, highlight_color);
}
@@ -465,7 +465,7 @@ LLScrollListCheck::LLScrollListCheck(const LLScrollListCell::Params& p)
setWidth(rect.getWidth()); //check_box->getWidth();
}
- mCheckBox->setColor(p.color);
+ mCheckBox->setColor(p.color());
}
@@ -613,18 +613,18 @@ void LLScrollListIconText::draw(const LLColor4& color, const LLColor4& highlight
switch (mFontAlignment)
{
case LLFontGL::LEFT:
- left = mFont->getWidth(mText.getString(), icon_space + 1, mHighlightOffset);
+ left = mFont->getWidth(mText.getWString().c_str(), icon_space + 1, mHighlightOffset);
break;
case LLFontGL::RIGHT:
- left = getWidth() - mFont->getWidth(mText.getString(), mHighlightOffset, S32_MAX) - icon_space;
+ left = getWidth() - mFont->getWidth(mText.getWString().c_str(), mHighlightOffset, S32_MAX) - icon_space;
break;
case LLFontGL::HCENTER:
- left = (getWidth() - mFont->getWidth(mText.getString()) - icon_space) / 2;
+ left = (getWidth() - mFont->getWidth(mText.getWString().c_str()) - icon_space) / 2;
break;
}
LLRect highlight_rect(left - 2,
mFont->getLineHeight() + 1,
- left + mFont->getWidth(mText.getString(), mHighlightOffset, mHighlightCount) + 1,
+ left + mFont->getWidth(mText.getWString().c_str(), mHighlightOffset, mHighlightCount) + 1,
1);
mRoundedRectImage->draw(highlight_rect, highlight_color);
}
@@ -637,17 +637,17 @@ void LLScrollListIconText::draw(const LLColor4& color, const LLColor4& highlight
switch (mFontAlignment)
{
case LLFontGL::LEFT:
- start_text_x = icon_space + 1;
+ start_text_x = icon_space + 1.f;
start_icon_x = 1;
break;
case LLFontGL::RIGHT:
start_text_x = (F32)getWidth();
- start_icon_x = getWidth() - mFont->getWidth(mText.getString()) - icon_space;
+ start_icon_x = getWidth() - mFont->getWidth(mText.getWString().c_str()) - icon_space;
break;
case LLFontGL::HCENTER:
F32 center = (F32)getWidth()* 0.5f;
start_text_x = center + ((F32)icon_space * 0.5f);
- start_icon_x = center - (((F32)icon_space + mFont->getWidth(mText.getString())) * 0.5f);
+ start_icon_x = (S32)(center - (((F32)icon_space + mFont->getWidth(mText.getWString().c_str())) * 0.5f));
break;
}
mFont->render(mText.getWString(), 0,
diff --git a/indra/llui/llscrolllistctrl.cpp b/indra/llui/llscrolllistctrl.cpp
index 1d9564d107..e711a6ed1b 100644
--- a/indra/llui/llscrolllistctrl.cpp
+++ b/indra/llui/llscrolllistctrl.cpp
@@ -196,7 +196,6 @@ LLScrollListCtrl::LLScrollListCtrl(const LLScrollListCtrl::Params& p)
mHighlightedItem(-1),
mBorder(NULL),
mSortCallback(NULL),
- mCommentTextView(NULL),
mNumDynamicWidthColumns(0),
mTotalStaticColumnWidth(0),
mTotalColumnPadding(0),
@@ -288,13 +287,6 @@ LLScrollListCtrl::LLScrollListCtrl(const LLScrollListCtrl::Params& p)
addColumn(*row_it);
}
- for (LLInitParam::ParamIterator<LLScrollListItem::Params>::const_iterator row_it = p.contents.rows.begin();
- row_it != p.contents.rows.end();
- ++row_it)
- {
- addRow(*row_it);
- }
-
LLTextBox::Params text_p;
text_p.name("comment_text");
text_p.border_visible(false);
@@ -302,7 +294,15 @@ LLScrollListCtrl::LLScrollListCtrl(const LLScrollListCtrl::Params& p)
text_p.follows.flags(FOLLOWS_ALL);
// word wrap was added accroding to the EXT-6841
text_p.wrap(true);
- addChild(LLUICtrlFactory::create<LLTextBox>(text_p));
+ mCommentText = LLUICtrlFactory::create<LLTextBox>(text_p);
+ addChild(mCommentText);
+
+ for (LLInitParam::ParamIterator<LLScrollListItem::Params>::const_iterator row_it = p.contents.rows.begin();
+ row_it != p.contents.rows.end();
+ ++row_it)
+ {
+ addRow(*row_it);
+ }
}
S32 LLScrollListCtrl::getSearchColumn()
@@ -541,12 +541,7 @@ void LLScrollListCtrl::updateLayout()
getRect().getWidth() - 2 * mBorderThickness,
getRect().getHeight() - (2 * mBorderThickness ) - heading_size );
- if (mCommentTextView == NULL)
- {
- mCommentTextView = getChildView("comment_text");
- }
-
- mCommentTextView->setShape(mItemListRect);
+ mCommentText->setShape(mItemListRect);
// how many lines of content in a single "page"
S32 page_lines = getLinesPerPage();
@@ -664,7 +659,7 @@ S32 LLScrollListCtrl::calcMaxContentWidth()
if (mColumnWidthsDirty)
{
// update max content width for this column, by looking at all items
- column->mMaxContentWidth = column->mHeader ? LLFontGL::getFontSansSerifSmall()->getWidth(column->mLabel) + mColumnPadding + HEADING_TEXT_PADDING : 0;
+ column->mMaxContentWidth = column->mHeader ? LLFontGL::getFontSansSerifSmall()->getWidth(column->mLabel.getWString().c_str()) + mColumnPadding + HEADING_TEXT_PADDING : 0;
item_list::iterator iter;
for (iter = mItemList.begin(); iter != mItemList.end(); iter++)
{
@@ -1244,7 +1239,7 @@ void LLScrollListCtrl::deselectAllItems(bool no_commit_on_change)
void LLScrollListCtrl::setCommentText(const std::string& comment_text)
{
- getChild<LLTextBox>("comment_text")->setValue(comment_text);
+ mCommentText->setValue(comment_text);
}
LLScrollListItem* LLScrollListCtrl::addSeparator(EAddPosition pos)
@@ -1479,10 +1474,9 @@ const std::string LLScrollListCtrl::getSelectedItemLabel(S32 column) const
item = getFirstSelected();
if (item)
{
- auto col = item->getColumn(column);
- if(col)
+ if (LLScrollListCell* cell = item->getColumn(column))
{
- return col->getValue().asString();
+ return cell->getValue().asString();
}
}
@@ -1728,7 +1722,7 @@ void LLScrollListCtrl::draw()
updateColumns();
- getChildView("comment_text")->setVisible(mItemList.empty());
+ mCommentText->setVisible(mItemList.empty());
drawItems();
@@ -2720,7 +2714,8 @@ struct SameSortColumn
bool LLScrollListCtrl::setSort(S32 column_idx, bool ascending)
{
LLScrollListColumn* sort_column = getColumn(column_idx);
- if (!sort_column) return false;
+ if (!sort_column)
+ return false;
sort_column->mSortDirection = ascending ? LLScrollListColumn::ASCENDING : LLScrollListColumn::DESCENDING;
@@ -2733,32 +2728,28 @@ bool LLScrollListCtrl::setSort(S32 column_idx, bool ascending)
mSortColumns.push_back(new_sort_column);
return true;
}
- else
- {
- // grab current sort column
- sort_column_t cur_sort_column = mSortColumns.back();
- // remove any existing sort criterion referencing this column
- // and add the new one
- mSortColumns.erase(remove_if(mSortColumns.begin(), mSortColumns.end(), SameSortColumn(column_idx)), mSortColumns.end());
- mSortColumns.push_back(new_sort_column);
+ // grab current sort column
+ sort_column_t cur_sort_column = mSortColumns.back();
- // did the sort criteria change?
- return (cur_sort_column != new_sort_column);
- }
+ // remove any existing sort criterion referencing this column
+ // and add the new one
+ mSortColumns.erase(remove_if(mSortColumns.begin(), mSortColumns.end(), SameSortColumn(column_idx)), mSortColumns.end());
+ mSortColumns.push_back(new_sort_column);
+
+ // did the sort criteria change?
+ return cur_sort_column != new_sort_column;
}
S32 LLScrollListCtrl::getLinesPerPage()
{
- //if mPageLines is NOT provided display all item
if (mPageLines)
{
return mPageLines;
}
- else
- {
- return mLineHeight ? mItemListRect.getHeight() / mLineHeight : getItemCount();
- }
+
+ // If mPageLines is NOT provided then display all items
+ return mLineHeight ? mItemListRect.getHeight() / mLineHeight : getItemCount();
}
@@ -2774,7 +2765,7 @@ void LLScrollListCtrl::sortByColumn(const std::string& name, bool ascending)
column_map_t::iterator itor = mColumns.find(name);
if (itor != mColumns.end())
{
- sortByColumnIndex((*itor).second->mIndex, ascending);
+ sortByColumnIndex(itor->second->mIndex, ascending);
}
}
@@ -3093,8 +3084,7 @@ std::string LLScrollListCtrl::getSortColumnName()
{
LLScrollListColumn* column = mSortColumns.empty() ? NULL : mColumnsIndexed[mSortColumns.back().first];
- if (column) return column->mName;
- else return "";
+ return column ? column->mName : LLStringUtil::null;
}
bool LLScrollListCtrl::hasSortOrder() const
diff --git a/indra/llui/llscrolllistctrl.h b/indra/llui/llscrolllistctrl.h
index f25ba61fd4..1f9f26e08b 100644
--- a/indra/llui/llscrolllistctrl.h
+++ b/indra/llui/llscrolllistctrl.h
@@ -530,7 +530,7 @@ private:
class LLViewBorder* mBorder;
LLHandle<LLContextMenu> mPopupMenuHandle;
- LLView *mCommentTextView;
+ LLTextBox* mCommentText = nullptr;
LLWString mSearchString;
LLFrameTimer mSearchTimer;
diff --git a/indra/llui/llsearchablecontrol.h b/indra/llui/llsearchablecontrol.h
index bccb4858e1..119852b763 100644
--- a/indra/llui/llsearchablecontrol.h
+++ b/indra/llui/llsearchablecontrol.h
@@ -43,7 +43,7 @@ namespace ll
virtual ~SearchableControl()
{ }
- LLColor4 getHighlightColor( ) const
+ const LLColor4& getHighlightColor( ) const
{
static LLUIColor highlight_color = LLUIColorTable::instance().getColor("SearchableControlHighlightColor", LLColor4::red);
return highlight_color.get();
diff --git a/indra/llui/llsliderctrl.cpp b/indra/llui/llsliderctrl.cpp
index 22579205d8..66e97f093f 100644
--- a/indra/llui/llsliderctrl.cpp
+++ b/indra/llui/llsliderctrl.cpp
@@ -225,7 +225,7 @@ bool LLSliderCtrl::setLabelArg( const std::string& key, const LLStringExplicit&
res = mLabelBox->setTextArg(key, text);
if (res && mLabelFont && mLabelWidth == 0)
{
- S32 label_width = mLabelFont->getWidth(mLabelBox->getText());
+ S32 label_width = mLabelFont->getWidth(mLabelBox->getWText().c_str());
LLRect rect = mLabelBox->getRect();
S32 prev_right = rect.mRight;
rect.mRight = rect.mLeft + label_width;
@@ -393,7 +393,7 @@ void LLSliderCtrl::setEnabled(bool b)
if( mLabelBox )
{
- mLabelBox->setColor( b ? mTextEnabledColor.get() : mTextDisabledColor.get() );
+ mLabelBox->setColor( b ? mTextEnabledColor : mTextDisabledColor );
}
mSlider->setEnabled( b );
@@ -405,7 +405,7 @@ void LLSliderCtrl::setEnabled(bool b)
if( mTextBox )
{
- mTextBox->setColor( b ? mTextEnabledColor.get() : mTextDisabledColor.get() );
+ mTextBox->setColor( b ? mTextEnabledColor : mTextDisabledColor );
}
}
diff --git a/indra/llui/llsliderctrl.h b/indra/llui/llsliderctrl.h
index a55e3bf6e9..311377a61f 100644
--- a/indra/llui/llsliderctrl.h
+++ b/indra/llui/llsliderctrl.h
@@ -107,8 +107,8 @@ public:
F32 getMaxValue() const { return mSlider->getMaxValue(); }
void setLabel(const LLStringExplicit& label) { if (mLabelBox) mLabelBox->setText(label); }
- void setLabelColor(const LLColor4& c) { mTextEnabledColor = c; }
- void setDisabledLabelColor(const LLColor4& c) { mTextDisabledColor = c; }
+ void setLabelColor(const LLUIColor& c) { mTextEnabledColor = c; }
+ void setDisabledLabelColor(const LLUIColor& c) { mTextDisabledColor = c; }
boost::signals2::connection setSliderMouseDownCallback( const commit_signal_t::slot_type& cb );
boost::signals2::connection setSliderMouseUpCallback( const commit_signal_t::slot_type& cb );
diff --git a/indra/llui/llspellcheck.cpp b/indra/llui/llspellcheck.cpp
index 1615db5b52..e15616a16b 100644
--- a/indra/llui/llspellcheck.cpp
+++ b/indra/llui/llspellcheck.cpp
@@ -30,12 +30,7 @@
#include "llsdserialize.h"
#include "llspellcheck.h"
-#if LL_WINDOWS
- #include <hunspell/hunspelldll.h>
- #pragma comment(lib, "libhunspell.lib")
-#else
- #include <hunspell/hunspell.hxx>
-#endif
+#include <hunspell/hunspell.hxx>
static const std::string DICT_DIR = "dictionaries";
static const std::string DICT_FILE_CUSTOM = "user_custom.dic";
@@ -47,28 +42,22 @@ static const std::string DICT_FILE_USER = "user_dictionaries.xml";
LLSpellChecker::settings_change_signal_t LLSpellChecker::sSettingsChangeSignal;
LLSpellChecker::LLSpellChecker()
- : mHunspell(NULL)
{
+ // Load initial dictionary information
+ refreshDictionaryMap();
}
LLSpellChecker::~LLSpellChecker()
{
- delete mHunspell;
-}
-
-void LLSpellChecker::initSingleton()
-{
- // Load initial dictionary information
- refreshDictionaryMap();
}
bool LLSpellChecker::checkSpelling(const std::string& word) const
{
- if ( (!mHunspell) || (word.length() < 3) || (0 != mHunspell->spell(word.c_str())) )
+ if ( (!mHunspell) || (word.length() < 3) || (0 != mHunspell->spell(word)) )
{
return true;
}
- if (mIgnoreList.size() > 0)
+ if (!mIgnoreList.empty())
{
std::string word_lower(word);
LLStringUtil::toLower(word_lower);
@@ -85,15 +74,8 @@ S32 LLSpellChecker::getSuggestions(const std::string& word, std::vector<std::str
return 0;
}
- char** suggestion_list; int suggestion_cnt = 0;
- if ( (suggestion_cnt = mHunspell->suggest(&suggestion_list, word.c_str())) != 0 )
- {
- for (int suggestion_index = 0; suggestion_index < suggestion_cnt; suggestion_index++)
- {
- suggestions.push_back(suggestion_list[suggestion_index]);
- }
- mHunspell->free_list(&suggestion_list, suggestion_cnt);
- }
+ suggestions = mHunspell->suggest(word);
+
return static_cast<S32>(suggestions.size());
}
@@ -194,7 +176,7 @@ void LLSpellChecker::addToCustomDictionary(const std::string& word)
{
if (mHunspell)
{
- mHunspell->add(word.c_str());
+ mHunspell->add(word);
}
addToDictFile(getDictionaryUserPath() + DICT_FILE_CUSTOM, word);
sSettingsChangeSignal();
@@ -312,8 +294,7 @@ void LLSpellChecker::initHunspell(const std::string& dict_language)
{
if (mHunspell)
{
- delete mHunspell;
- mHunspell = NULL;
+ mHunspell.reset();
mDictLanguage.clear();
mDictFile.clear();
mIgnoreList.clear();
@@ -334,11 +315,11 @@ void LLSpellChecker::initHunspell(const std::string& dict_language)
const std::string filename_dic = dict_entry["name"].asString() + ".dic";
if ( (gDirUtilp->fileExists(user_path + filename_aff)) && (gDirUtilp->fileExists(user_path + filename_dic)) )
{
- mHunspell = new Hunspell((user_path + filename_aff).c_str(), (user_path + filename_dic).c_str());
+ mHunspell = std::make_unique<Hunspell>((user_path + filename_aff).c_str(), (user_path + filename_dic).c_str());
}
else if ( (gDirUtilp->fileExists(app_path + filename_aff)) && (gDirUtilp->fileExists(app_path + filename_dic)) )
{
- mHunspell = new Hunspell((app_path + filename_aff).c_str(), (app_path + filename_dic).c_str());
+ mHunspell = std::make_unique<Hunspell>((app_path + filename_aff).c_str(), (app_path + filename_dic).c_str());
}
if (!mHunspell)
{
@@ -422,7 +403,7 @@ bool LLSpellChecker::canRemoveDictionary(const std::string& dict_language)
const LLSD dict_info = getDictionaryData(dict_language);
return
(dict_info["user_installed"].asBoolean()) &&
- ( (!getUseSpellCheck()) || (!LLSpellChecker::instance().isActiveDictionary(dict_language)) );
+ ( (!getUseSpellCheck()) || (!isActiveDictionary(dict_language)) );
}
void LLSpellChecker::removeDictionary(const std::string& dict_language)
@@ -448,7 +429,7 @@ void LLSpellChecker::removeDictionary(const std::string& dict_language)
{
LLFile::remove(dict_aff);
}
- dict_map.erase(it - dict_map.beginArray());
+ dict_map.erase((LLSD::Integer)(it - dict_map.beginArray()));
break;
}
}
diff --git a/indra/llui/llspellcheck.h b/indra/llui/llspellcheck.h
index e4d8a12ef1..9df2f94085 100644
--- a/indra/llui/llspellcheck.h
+++ b/indra/llui/llspellcheck.h
@@ -34,12 +34,12 @@
class Hunspell;
-class LLSpellChecker : public LLSingleton<LLSpellChecker>
+class LLSpellChecker : public LLSimpleton<LLSpellChecker>
{
- LLSINGLETON(LLSpellChecker);
+public:
+ LLSpellChecker();
~LLSpellChecker();
-public:
void addToCustomDictionary(const std::string& word);
void addToIgnoreList(const std::string& word);
bool checkSpelling(const std::string& word) const;
@@ -47,7 +47,6 @@ public:
protected:
void addToDictFile(const std::string& dict_path, const std::string& word);
void initHunspell(const std::string& dict_language);
- void initSingleton() override;
public:
typedef std::list<std::string> dict_list_t;
@@ -77,7 +76,7 @@ public:
static boost::signals2::connection setSettingsChangeCallback(const settings_change_signal_t::slot_type& cb);
protected:
- Hunspell* mHunspell;
+ std::unique_ptr<Hunspell> mHunspell;
std::string mDictLanguage;
std::string mDictFile;
dict_list_t mDictSecondary;
diff --git a/indra/llui/llspinctrl.cpp b/indra/llui/llspinctrl.cpp
index 7d41d80334..8cd3e6419a 100644
--- a/indra/llui/llspinctrl.cpp
+++ b/indra/llui/llspinctrl.cpp
@@ -310,7 +310,7 @@ void LLSpinCtrl::updateLabelColor()
{
if( mLabelBox )
{
- mLabelBox->setColor( getEnabled() ? mTextEnabledColor.get() : mTextDisabledColor.get() );
+ mLabelBox->setColor( getEnabled() ? mTextEnabledColor : mTextDisabledColor );
}
}
diff --git a/indra/llui/llspinctrl.h b/indra/llui/llspinctrl.h
index 75f1830d80..58b38dc630 100644
--- a/indra/llui/llspinctrl.h
+++ b/indra/llui/llspinctrl.h
@@ -77,8 +77,8 @@ public:
virtual void setPrecision(S32 precision);
void setLabel(const LLStringExplicit& label);
- void setLabelColor(const LLColor4& c) { mTextEnabledColor = c; updateLabelColor(); }
- void setDisabledLabelColor(const LLColor4& c) { mTextDisabledColor = c; updateLabelColor();}
+ void setLabelColor(const LLUIColor& c) { mTextEnabledColor = c; updateLabelColor(); }
+ void setDisabledLabelColor(const LLUIColor& c) { mTextDisabledColor = c; updateLabelColor();}
void setAllowEdit(bool allow_edit);
virtual void onTabInto();
diff --git a/indra/llui/llstatbar.cpp b/indra/llui/llstatbar.cpp
index adb1d51813..2693243eb1 100644
--- a/indra/llui/llstatbar.cpp
+++ b/indra/llui/llstatbar.cpp
@@ -66,7 +66,7 @@ F32 calc_tick_value(F32 min, F32 max)
S32 num_whole_digits = llceil(logf(llabs(min + possible_tick_value)) * OO_LN10);
for (S32 digit_count = -(num_whole_digits - 1); digit_count < 6; digit_count++)
{
- F32 test_tick_value = min + (possible_tick_value * pow(10.0, digit_count));
+ F32 test_tick_value = min + (possible_tick_value * (F32)pow(10.0, digit_count));
if (is_approx_equal((F32)(S32)test_tick_value, test_tick_value))
{
@@ -99,7 +99,7 @@ void calc_auto_scale_range(F32& min, F32& max, F32& tick)
: llceil(logf(llabs(min)) * OO_LN10);
const S32 num_digits = llmax(num_digits_max, num_digits_min);
- const F32 power_of_10 = pow(10.0, num_digits - 1);
+ const F32 power_of_10 = (F32)pow(10.0, num_digits - 1);
const F32 starting_max = power_of_10 * ((max < 0.f) ? -1 : 1);
const F32 starting_min = power_of_10 * ((min < 0.f) ? -1 : 1);
@@ -313,13 +313,13 @@ void LLStatBar::draw()
const LLTrace::StatType<LLTrace::CountAccumulator>& count_stat = *mStat.countStatp;
unit_label = std::string(count_stat.getUnitLabel()) + "/s";
- current = last_frame_recording.getPerSec(count_stat);
- min = frame_recording.getPeriodMinPerSec(count_stat, num_frames);
- max = frame_recording.getPeriodMaxPerSec(count_stat, num_frames);
- mean = frame_recording.getPeriodMeanPerSec(count_stat, num_frames);
+ current = (F32)last_frame_recording.getPerSec(count_stat);
+ min = (F32)frame_recording.getPeriodMinPerSec(count_stat, num_frames);
+ max = (F32)frame_recording.getPeriodMaxPerSec(count_stat, num_frames);
+ mean = (F32)frame_recording.getPeriodMeanPerSec(count_stat, num_frames);
if (mShowMedian)
{
- display_value = frame_recording.getPeriodMedianPerSec(count_stat, num_frames);
+ display_value = (F32)frame_recording.getPeriodMedianPerSec(count_stat, num_frames);
}
else
{
@@ -332,10 +332,10 @@ void LLStatBar::draw()
const LLTrace::StatType<LLTrace::EventAccumulator>& event_stat = *mStat.eventStatp;
unit_label = mUnitLabel.empty() ? event_stat.getUnitLabel() : mUnitLabel;
- current = last_frame_recording.getLastValue(event_stat);
- min = frame_recording.getPeriodMin(event_stat, num_frames);
- max = frame_recording.getPeriodMax(event_stat, num_frames);
- mean = frame_recording.getPeriodMean(event_stat, num_frames);
+ current = (F32)last_frame_recording.getLastValue(event_stat);
+ min = (F32)frame_recording.getPeriodMin(event_stat, num_frames);
+ max = (F32)frame_recording.getPeriodMax(event_stat, num_frames);
+ mean = (F32)frame_recording.getPeriodMean(event_stat, num_frames);
display_value = mean;
}
break;
@@ -344,15 +344,15 @@ void LLStatBar::draw()
const LLTrace::StatType<LLTrace::SampleAccumulator>& sample_stat = *mStat.sampleStatp;
unit_label = mUnitLabel.empty() ? sample_stat.getUnitLabel() : mUnitLabel;
- current = last_frame_recording.getLastValue(sample_stat);
- min = frame_recording.getPeriodMin(sample_stat, num_frames);
- max = frame_recording.getPeriodMax(sample_stat, num_frames);
- mean = frame_recording.getPeriodMean(sample_stat, num_frames);
+ current = (F32)last_frame_recording.getLastValue(sample_stat);
+ min = (F32)frame_recording.getPeriodMin(sample_stat, num_frames);
+ max = (F32)frame_recording.getPeriodMax(sample_stat, num_frames);
+ mean = (F32)frame_recording.getPeriodMean(sample_stat, num_frames);
num_rapid_changes = calc_num_rapid_changes(frame_recording, sample_stat, RAPID_CHANGE_WINDOW);
if (mShowMedian)
{
- display_value = frame_recording.getPeriodMedian(sample_stat, num_frames);
+ display_value = (F32)frame_recording.getPeriodMedian(sample_stat, num_frames);
}
else if (num_rapid_changes / RAPID_CHANGE_WINDOW.value() > MAX_RAPID_CHANGES_PER_SEC)
{
@@ -450,8 +450,8 @@ void LLStatBar::draw()
}
F32 span = (mOrientation == HORIZONTAL)
- ? (bar_rect.getWidth())
- : (bar_rect.getHeight());
+ ? (F32)(bar_rect.getWidth())
+ : (F32)(bar_rect.getHeight());
if (mDisplayHistory && mStat.valid)
{
@@ -471,18 +471,18 @@ void LLStatBar::draw()
switch(mStatType)
{
case STAT_COUNT:
- min_value = recording.getPerSec(*mStat.countStatp);
+ min_value = (F32)recording.getPerSec(*mStat.countStatp);
max_value = min_value;
num_samples = recording.getSampleCount(*mStat.countStatp);
break;
case STAT_EVENT:
- min_value = recording.getMin(*mStat.eventStatp);
- max_value = recording.getMax(*mStat.eventStatp);
+ min_value = (F32)recording.getMin(*mStat.eventStatp);
+ max_value = (F32)recording.getMax(*mStat.eventStatp);
num_samples = recording.getSampleCount(*mStat.eventStatp);
break;
case STAT_SAMPLE:
- min_value = recording.getMin(*mStat.sampleStatp);
- max_value = recording.getMax(*mStat.sampleStatp);
+ min_value = (F32)recording.getMin(*mStat.sampleStatp);
+ max_value = (F32)recording.getMax(*mStat.sampleStatp);
num_samples = recording.getSampleCount(*mStat.sampleStatp);
break;
default:
@@ -598,7 +598,7 @@ LLRect LLStatBar::getRequiredRect()
void LLStatBar::drawLabelAndValue( F32 value, std::string &label, LLRect &bar_rect, S32 decimal_digits )
{
- LLFontGL::getFontMonospace()->renderUTF8(mLabel, 0, 0, getRect().getHeight(), LLColor4(1.f, 1.f, 1.f, 1.f),
+ LLFontGL::getFontMonospace()->render(mLabel.getWString(), 0, 0.F, (F32)getRect().getHeight(), LLColor4(1.f, 1.f, 1.f, 1.f),
LLFontGL::LEFT, LLFontGL::TOP);
std::string value_str = !llisnan(value)
@@ -673,14 +673,14 @@ void LLStatBar::drawTicks( F32 min, F32 max, F32 value_scale, LLRect &bar_rect )
{
decimal_digits = 0;
}
- std::string tick_label = llformat("%.*f", decimal_digits, tick_value);
- S32 tick_label_width = LLFontGL::getFontMonospace()->getWidth(tick_label);
+ LLWString tick_label = utf8str_to_wstring(llformat("%.*f", decimal_digits, tick_value));
+ S32 tick_label_width = LLFontGL::getFontMonospace()->getWidth(tick_label.c_str());
if (mOrientation == HORIZONTAL)
{
if (tick_begin > last_label + MIN_LABEL_SPACING)
{
gl_rect_2d(bar_rect.mLeft, tick_end, bar_rect.mRight - TICK_LENGTH, tick_begin, LLColor4(1.f, 1.f, 1.f, 0.25f));
- LLFontGL::getFontMonospace()->renderUTF8(tick_label, 0, bar_rect.mRight, tick_begin,
+ LLFontGL::getFontMonospace()->render(tick_label, 0, (F32)bar_rect.mRight, (F32)tick_begin,
LLColor4(1.f, 1.f, 1.f, 0.5f),
LLFontGL::LEFT, LLFontGL::VCENTER);
last_label = tick_begin;
@@ -696,7 +696,7 @@ void LLStatBar::drawTicks( F32 min, F32 max, F32 value_scale, LLRect &bar_rect )
{
gl_rect_2d(tick_begin, bar_rect.mTop, tick_end, bar_rect.mBottom - TICK_LENGTH, LLColor4(1.f, 1.f, 1.f, 0.25f));
S32 label_pos = tick_begin - ll_round((F32)tick_label_width * ((F32)tick_begin / (F32)bar_rect.getWidth()));
- LLFontGL::getFontMonospace()->renderUTF8(tick_label, 0, label_pos, bar_rect.mBottom - TICK_LENGTH,
+ LLFontGL::getFontMonospace()->render(tick_label, 0, (F32)label_pos, (F32)(bar_rect.mBottom - TICK_LENGTH),
LLColor4(1.f, 1.f, 1.f, 0.5f),
LLFontGL::LEFT, LLFontGL::TOP);
last_label = label_pos;
diff --git a/indra/llui/llstatgraph.cpp b/indra/llui/llstatgraph.cpp
index d37f927073..d97051247e 100644
--- a/indra/llui/llstatgraph.cpp
+++ b/indra/llui/llstatgraph.cpp
@@ -70,11 +70,11 @@ void LLStatGraph::draw()
if (mPerSec)
{
- mValue = recording.getPerSec(*mNewStatFloatp);
+ mValue = (F32)recording.getPerSec(*mNewStatFloatp);
}
else
{
- mValue = recording.getSum(*mNewStatFloatp);
+ mValue = (F32)recording.getSum(*mNewStatFloatp);
}
}
@@ -93,8 +93,6 @@ void LLStatGraph::draw()
mUpdateTimer.reset();
}
- LLColor4 color;
-
threshold_vec_t::iterator it = std::lower_bound(mThresholds.begin(), mThresholds.end(), Threshold(mValue / mMax, LLUIColor()));
if (it != mThresholds.begin())
@@ -102,15 +100,14 @@ void LLStatGraph::draw()
it--;
}
- color = LLUIColorTable::instance().getColor( "MenuDefaultBgColor" );
- gGL.color4fv(color.mV);
+ static LLUIColor default_color = LLUIColorTable::instance().getColor( "MenuDefaultBgColor" );
+ gGL.color4fv(default_color.get().mV);
gl_rect_2d(0, getRect().getHeight(), getRect().getWidth(), 0, true);
gGL.color4fv(LLColor4::black.mV);
gl_rect_2d(0, getRect().getHeight(), getRect().getWidth(), 0, false);
- color = it->mColor;
- gGL.color4fv(color.mV);
+ gGL.color4fv(it->mColor().mV);
gl_rect_2d(1, ll_round(frac*getRect().getHeight()), getRect().getWidth() - 1, 0, true);
}
diff --git a/indra/llui/llstyle.cpp b/indra/llui/llstyle.cpp
index abf6e1284b..df4b0ef6a0 100644
--- a/indra/llui/llstyle.cpp
+++ b/indra/llui/llstyle.cpp
@@ -33,11 +33,12 @@
#include "llui.h"
LLStyle::Params::Params()
-: visible("visible", true),
+ : visible("visible", true),
drop_shadow("drop_shadow", LLFontGL::NO_SHADOW),
color("color", LLColor4::black),
readonly_color("readonly_color", LLColor4::black),
selected_color("selected_color", LLColor4::black),
+ alpha("alpha", 1.f),
font("font", LLFontGL::getFontMonospace()),
image("image"),
link_href("href"),
@@ -54,7 +55,8 @@ LLStyle::LLStyle(const LLStyle::Params& p)
mLink(p.link_href),
mIsLink(p.is_link.isProvided() ? p.is_link : !p.link_href().empty()),
mDropShadow(p.drop_shadow),
- mImagep(p.image())
+ mImagep(p.image()),
+ mAlpha(p.alpha)
{}
void LLStyle::setFont(const LLFontGL* font)
diff --git a/indra/llui/llstyle.h b/indra/llui/llstyle.h
index 7dbccfff87..e506895de5 100644
--- a/indra/llui/llstyle.h
+++ b/indra/llui/llstyle.h
@@ -44,6 +44,7 @@ public:
Optional<LLUIColor> color,
readonly_color,
selected_color;
+ Optional<F32> alpha;
Optional<const LLFontGL*> font;
Optional<LLUIImage*> image;
Optional<std::string> link_href;
@@ -61,6 +62,9 @@ public:
const LLUIColor& getSelectedColor() const { return mSelectedColor; }
void setSelectedColor(const LLUIColor& color) { mSelectedColor = color; }
+ F32 getAlpha() const { return mAlpha; }
+ void setAlpha(F32 alpha) { mAlpha = alpha; }
+
bool isVisible() const;
void setVisible(bool is_visible);
@@ -89,7 +93,8 @@ public:
&& mFont == rhs.mFont
&& mLink == rhs.mLink
&& mImagep == rhs.mImagep
- && mDropShadow == rhs.mDropShadow;
+ && mDropShadow == rhs.mDropShadow
+ && mAlpha == rhs.mAlpha;
}
bool operator!=(const LLStyle& rhs) const { return !(*this == rhs); }
@@ -98,18 +103,19 @@ public:
LLFontGL::ShadowType mDropShadow;
protected:
- ~LLStyle() { }
+ ~LLStyle() = default;
private:
- bool mVisible;
+ std::string mFontName;
+ std::string mLink;
LLUIColor mColor;
LLUIColor mReadOnlyColor;
LLUIColor mSelectedColor;
- std::string mFontName;
const LLFontGL* mFont;
- std::string mLink;
- bool mIsLink;
LLPointer<LLUIImage> mImagep;
+ F32 mAlpha;
+ bool mVisible;
+ bool mIsLink;
};
typedef LLPointer<LLStyle> LLStyleSP;
diff --git a/indra/llui/lltabcontainer.cpp b/indra/llui/lltabcontainer.cpp
index 06f584d372..595ab0bd2b 100644
--- a/indra/llui/lltabcontainer.cpp
+++ b/indra/llui/lltabcontainer.cpp
@@ -315,7 +315,7 @@ void LLTabContainer::reshape(S32 width, S32 height, bool called_from_parent)
}
//virtual
-LLView* LLTabContainer::getChildView(const std::string& name, bool recurse) const
+LLView* LLTabContainer::getChildView(std::string_view name, bool recurse) const
{
tuple_list_t::const_iterator itor;
for (itor = mTabList.begin(); itor != mTabList.end(); ++itor)
@@ -343,7 +343,7 @@ LLView* LLTabContainer::getChildView(const std::string& name, bool recurse) cons
}
//virtual
-LLView* LLTabContainer::findChildView(const std::string& name, bool recurse) const
+LLView* LLTabContainer::findChildView(std::string_view name, bool recurse) const
{
tuple_list_t::const_iterator itor;
for (itor = mTabList.begin(); itor != mTabList.end(); ++itor)
@@ -1401,7 +1401,7 @@ S32 LLTabContainer::getIndexForPanel(LLPanel* panel)
return -1;
}
-S32 LLTabContainer::getPanelIndexByTitle(const std::string& title)
+S32 LLTabContainer::getPanelIndexByTitle(std::string_view title)
{
for (S32 index = 0 ; index < (S32)mTabList.size(); index++)
{
@@ -1413,7 +1413,7 @@ S32 LLTabContainer::getPanelIndexByTitle(const std::string& title)
return -1;
}
-LLPanel* LLTabContainer::getPanelByName(const std::string& name)
+LLPanel* LLTabContainer::getPanelByName(std::string_view name)
{
for (S32 index = 0 ; index < (S32)mTabList.size(); index++)
{
@@ -1637,7 +1637,7 @@ bool LLTabContainer::setTab(S32 which)
return is_visible;
}
-bool LLTabContainer::selectTabByName(const std::string& name)
+bool LLTabContainer::selectTabByName(std::string_view name)
{
LLPanel* panel = getPanelByName(name);
if (!panel)
@@ -2189,7 +2189,7 @@ void LLTabContainer::setTabVisibility( LLPanel const *aPanel, bool aVisible )
LLTabTuple const *pTT = *itr;
if( pTT->mVisible )
{
- this->selectTab( itr - mTabList.begin() );
+ this->selectTab((S32)(itr - mTabList.begin()));
foundTab = true;
break;
}
diff --git a/indra/llui/lltabcontainer.h b/indra/llui/lltabcontainer.h
index b22eec2fe5..40f272ffa8 100644
--- a/indra/llui/lltabcontainer.h
+++ b/indra/llui/lltabcontainer.h
@@ -149,8 +149,8 @@ public:
/*virtual*/ bool handleDragAndDrop(S32 x, S32 y, MASK mask, bool drop,
EDragAndDropType type, void* cargo_data,
EAcceptance* accept, std::string& tooltip);
- /*virtual*/ LLView* getChildView(const std::string& name, bool recurse = true) const;
- /*virtual*/ LLView* findChildView(const std::string& name, bool recurse = true) const;
+ /*virtual*/ LLView* getChildView(std::string_view name, bool recurse = true) const;
+ /*virtual*/ LLView* findChildView(std::string_view name, bool recurse = true) const;
/*virtual*/ void initFromParams(const LLPanel::Params& p);
/*virtual*/ bool addChild(LLView* view, S32 tab_group = 0);
/*virtual*/ bool postBuild();
@@ -190,8 +190,8 @@ public:
S32 getTabCount();
LLPanel* getPanelByIndex(S32 index);
S32 getIndexForPanel(LLPanel* panel);
- S32 getPanelIndexByTitle(const std::string& title);
- LLPanel* getPanelByName(const std::string& name);
+ S32 getPanelIndexByTitle(std::string_view title);
+ LLPanel* getPanelByName(std::string_view name);
S32 getTotalTabWidth() const;
void setCurrentTabName(const std::string& name);
@@ -201,7 +201,7 @@ public:
void selectPrevTab();
bool selectTabPanel( LLPanel* child );
bool selectTab(S32 which);
- bool selectTabByName(const std::string& title);
+ bool selectTabByName(std::string_view title);
void setCurrentPanelIndex(S32 index) { mCurrentTabIdx = index; }
bool getTabPanelFlashing(LLPanel* child);
diff --git a/indra/llui/lltextbase.cpp b/indra/llui/lltextbase.cpp
index 1d358a0e9d..0aebf7543c 100644
--- a/indra/llui/lltextbase.cpp
+++ b/indra/llui/lltextbase.cpp
@@ -401,8 +401,8 @@ std::vector<LLRect> LLTextBase::getSelectionRects()
// Use F32 otherwise a string of multiple segments
// will accumulate a large error
- F32 left_precise = line_iter->mRect.mLeft;
- F32 right_precise = line_iter->mRect.mLeft;
+ F32 left_precise = (F32)line_iter->mRect.mLeft;
+ F32 right_precise = (F32)line_iter->mRect.mLeft;
for (; segment_iter != mSegments.end(); ++segment_iter, segment_offset = 0)
{
@@ -448,8 +448,8 @@ std::vector<LLRect> LLTextBase::getSelectionRects()
}
LLRect selection_rect;
- selection_rect.mLeft = left_precise;
- selection_rect.mRight = right_precise;
+ selection_rect.mLeft = (S32)left_precise;
+ selection_rect.mRight = (S32)right_precise;
selection_rect.mBottom = line_iter->mRect.mBottom;
selection_rect.mTop = line_iter->mRect.mTop;
@@ -584,9 +584,8 @@ void LLTextBase::drawCursor()
if (LL_KIM_OVERWRITE == gKeyboard->getInsertMode() && !hasSelection() && text[mCursorPos] != '\n')
{
- LLColor4 text_color;
const LLFontGL* fontp;
- text_color = segmentp->getColor();
+ const LLColor4& text_color = segmentp->getColor();
fontp = segmentp->getStyle()->getFont();
fontp->render(text, mCursorPos, cursor_rect,
LLColor4(1.f - text_color.mV[VRED], 1.f - text_color.mV[VGREEN], 1.f - text_color.mV[VBLUE], alpha),
@@ -598,7 +597,7 @@ void LLTextBase::drawCursor()
// Make sure the IME is in the right place
LLRect screen_pos = calcScreenRect();
- LLCoordGL ime_pos( screen_pos.mLeft + llfloor(cursor_rect.mLeft), screen_pos.mBottom + llfloor(cursor_rect.mTop) );
+ LLCoordGL ime_pos( screen_pos.mLeft + cursor_rect.mLeft, screen_pos.mBottom + cursor_rect.mTop );
ime_pos.mX = (S32) (ime_pos.mX * LLUI::getScaleFactor().mV[VX]);
ime_pos.mY = (S32) (ime_pos.mY * LLUI::getScaleFactor().mV[VY]);
@@ -755,9 +754,9 @@ void LLTextBase::drawText()
line_end = next_start;
}
- LLRectf text_rect(line.mRect.mLeft, line.mRect.mTop, line.mRect.mRight, line.mRect.mBottom);
- text_rect.mRight = mDocumentView->getRect().getWidth(); // clamp right edge to document extents
- text_rect.translate(mDocumentView->getRect().mLeft, mDocumentView->getRect().mBottom); // adjust by scroll position
+ LLRectf text_rect((F32)line.mRect.mLeft, (F32)line.mRect.mTop, (F32)line.mRect.mRight, (F32)line.mRect.mBottom);
+ text_rect.mRight = (F32)mDocumentView->getRect().getWidth(); // clamp right edge to document extents
+ text_rect.translate((F32)mDocumentView->getRect().mLeft, (F32)mDocumentView->getRect().mBottom); // adjust by scroll position
// draw a single line of text
S32 seg_start = line_start;
@@ -802,13 +801,13 @@ void LLTextBase::drawText()
S32 squiggle_start = 0, squiggle_end = 0, pony = 0;
cur_segment->getDimensions(seg_start - cur_segment->getStart(), misspell_start - seg_start, squiggle_start, pony);
cur_segment->getDimensions(misspell_start - cur_segment->getStart(), misspell_end - misspell_start, squiggle_end, pony);
- squiggle_start += text_rect.mLeft;
+ squiggle_start += (S32)text_rect.mLeft;
pony = (squiggle_end + 3) / 6;
squiggle_start += squiggle_end / 2 - pony * 3;
squiggle_end = squiggle_start + pony * 6;
- S32 squiggle_bottom = text_rect.mBottom + (S32)cur_segment->getStyle()->getFont()->getDescenderHeight();
+ S32 squiggle_bottom = (S32)text_rect.mBottom + (S32)cur_segment->getStyle()->getFont()->getDescenderHeight();
gGL.color4ub(255, 0, 0, 200);
while (squiggle_start + 1 < squiggle_end)
@@ -1368,7 +1367,7 @@ void LLTextBase::draw()
{
bg_rect.intersectWith(text_rect);
}
- LLColor4 bg_color = mReadOnly
+ const LLColor4& bg_color = mReadOnly
? mReadOnlyBgColor.get()
: hasFocus()
? mFocusBgColor.get()
@@ -1379,7 +1378,7 @@ void LLTextBase::draw()
// Draw highlighted if needed
if( ll::ui::SearchableControl::getHighlighted() )
{
- LLColor4 bg_color = ll::ui::SearchableControl::getHighlightColor();
+ const LLColor4& bg_color = ll::ui::SearchableControl::getHighlightColor();
LLRect bg_rect = mVisibleTextRect;
if( mScroller )
bg_rect.intersectWith( text_rect );
@@ -1412,14 +1411,14 @@ void LLTextBase::draw()
//virtual
-void LLTextBase::setColor( const LLColor4& c )
+void LLTextBase::setColor( const LLUIColor& c )
{
mFgColor = c;
mStyleDirty = true;
}
//virtual
-void LLTextBase::setReadOnlyColor(const LLColor4 &c)
+void LLTextBase::setReadOnlyColor(const LLUIColor &c)
{
mReadOnlyFgColor = c;
mStyleDirty = true;
@@ -1674,7 +1673,7 @@ void LLTextBase::reflow()
segment_set_t::iterator seg_iter = mSegments.begin();
S32 seg_offset = 0;
S32 line_start_index = 0;
- const F32 text_available_width = mVisibleTextRect.getWidth() - mHPad; // reserve room for margin
+ const F32 text_available_width = (F32)(mVisibleTextRect.getWidth() - mHPad); // reserve room for margin
F32 remaining_pixels = text_available_width;
S32 line_count = 0;
@@ -1881,7 +1880,7 @@ S32 LLTextBase::getLineNumFromDocIndex( S32 doc_index, bool include_wordwrap) co
line_list_t::const_iterator iter = std::upper_bound(mLineInfoList.begin(), mLineInfoList.end(), doc_index, line_end_compare());
if (include_wordwrap)
{
- return iter - mLineInfoList.begin();
+ return (S32)(iter - mLineInfoList.begin());
}
else
{
@@ -1918,7 +1917,7 @@ S32 LLTextBase::getFirstVisibleLine() const
// binary search for line that starts before top of visible buffer
line_list_t::const_iterator iter = std::lower_bound(mLineInfoList.begin(), mLineInfoList.end(), visible_region.mTop, compare_bottom());
- return iter - mLineInfoList.begin();
+ return (S32)(iter - mLineInfoList.begin());
}
std::pair<S32, S32> LLTextBase::getVisibleLines(bool require_fully_visible)
@@ -1940,7 +1939,7 @@ std::pair<S32, S32> LLTextBase::getVisibleLines(bool require_fully_visible)
first_iter = std::upper_bound(mLineInfoList.begin(), mLineInfoList.end(), visible_region.mTop, compare_bottom());
last_iter = std::lower_bound(mLineInfoList.begin(), mLineInfoList.end(), visible_region.mBottom, compare_top());
}
- return std::pair<S32, S32>(first_iter - mLineInfoList.begin(), last_iter - mLineInfoList.begin());
+ return std::pair<S32, S32>((S32)(first_iter - mLineInfoList.begin()), (S32)(last_iter - mLineInfoList.begin()));
}
@@ -2203,8 +2202,8 @@ static LLUIImagePtr image_from_icon_name(const std::string& icon_name)
void LLTextBase::appendTextImpl(const std::string &new_text, const LLStyle::Params& input_params)
{
LL_PROFILE_ZONE_SCOPED_CATEGORY_UI;
- LLStyle::Params style_params(input_params);
- style_params.fillFrom(getStyleParams());
+ LLStyle::Params style_params(getStyleParams());
+ style_params.overwriteFrom(input_params);
S32 part = (S32)LLTextParser::WHOLE;
if (mParseHTML && !style_params.is_link) // Don't search for URLs inside a link segment (STORM-358).
@@ -2418,16 +2417,14 @@ void LLTextBase::appendAndHighlightTextImpl(const std::string &new_text, S32 hig
{
LLStyle::Params highlight_params(style_params);
- LLSD pieces = LLTextParser::instance().parsePartialLineHighlights(new_text, highlight_params.color(), (LLTextParser::EHighlightPosition)highlight_part);
+ auto pieces = LLTextParser::instance().parsePartialLineHighlights(new_text, highlight_params.color, (LLTextParser::EHighlightPosition)highlight_part);
for (S32 i = 0; i < pieces.size(); i++)
{
- LLSD color_llsd = pieces[i]["color"];
- LLColor4 lcolor;
- lcolor.setValue(color_llsd);
- highlight_params.color = lcolor;
+ const auto& piece_pair = pieces[i];
+ highlight_params.color = piece_pair.second;
LLWString wide_text;
- wide_text = utf8str_to_wstring(pieces[i]["text"].asString());
+ wide_text = utf8str_to_wstring(piece_pair.first);
S32 cur_length = getLength();
LLStyleConstSP sp(new LLStyle(highlight_params));
@@ -2608,7 +2605,7 @@ S32 LLTextBase::getDocIndexFromLocalCoord( S32 local_x, S32 local_y, bool round,
}
S32 pos = getLength();
- F32 start_x = line_iter->mRect.mLeft + doc_rect.mLeft;
+ F32 start_x = (F32)(line_iter->mRect.mLeft + doc_rect.mLeft);
segment_set_t::iterator line_seg_iter;
S32 line_seg_offset;
@@ -2626,7 +2623,7 @@ S32 LLTextBase::getDocIndexFromLocalCoord( S32 local_x, S32 local_y, bool round,
if(newline)
{
- pos = segment_line_start + segmentp->getOffset(local_x - start_x, line_seg_offset, segment_line_length, round);
+ pos = segment_line_start + segmentp->getOffset(local_x - (S32)start_x, line_seg_offset, segment_line_length, round);
break;
}
@@ -2656,7 +2653,7 @@ S32 LLTextBase::getDocIndexFromLocalCoord( S32 local_x, S32 local_y, bool round,
}
else
{
- offset = segmentp->getOffset(local_x - start_x, line_seg_offset, segment_line_length, round);
+ offset = segmentp->getOffset(local_x - (S32)start_x, line_seg_offset, segment_line_length, round);
}
pos = segment_line_start + offset;
break;
@@ -2703,7 +2700,7 @@ LLRect LLTextBase::getDocRectFromDocIndex(S32 pos) const
getSegmentAndOffset(line_iter->mDocIndexStart, &line_seg_iter, &line_seg_offset);
getSegmentAndOffset(pos, &cursor_seg_iter, &cursor_seg_offset);
- F32 doc_left_precise = line_iter->mRect.mLeft;
+ F32 doc_left_precise = (F32)line_iter->mRect.mLeft;
while(line_seg_iter != mSegments.end())
{
@@ -2734,7 +2731,7 @@ LLRect LLTextBase::getDocRectFromDocIndex(S32 pos) const
}
LLRect doc_rect;
- doc_rect.mLeft = doc_left_precise;
+ doc_rect.mLeft = (S32)doc_left_precise;
doc_rect.mBottom = line_iter->mRect.mBottom;
doc_rect.mTop = line_iter->mRect.mTop;
@@ -3247,8 +3244,8 @@ F32 LLTextSegment::draw(S32 start, S32 end, S32 selection_start, S32 selection_e
bool LLTextSegment::canEdit() const { return false; }
void LLTextSegment::unlinkFromDocument(LLTextBase*) {}
void LLTextSegment::linkToDocument(LLTextBase*) {}
-const LLColor4& LLTextSegment::getColor() const { return LLColor4::white; }
-//void LLTextSegment::setColor(const LLColor4 &color) {}
+const LLUIColor& LLTextSegment::getColor() const { static const LLUIColor white = LLUIColorTable::instance().getColor("White", LLColor4::white); return white; }
+//void LLTextSegment::setColor(const LLUIColor &color) {}
LLStyleConstSP LLTextSegment::getStyle() const {static LLStyleConstSP sp(new LLStyle()); return sp; }
void LLTextSegment::setStyle(LLStyleConstSP style) {}
void LLTextSegment::setToken( LLKeywordToken* token ) {}
@@ -3294,7 +3291,7 @@ LLNormalTextSegment::LLNormalTextSegment( LLStyleConstSP style, S32 start, S32 e
}
}
-LLNormalTextSegment::LLNormalTextSegment( const LLColor4& color, S32 start, S32 end, LLTextBase& editor, bool is_visible)
+LLNormalTextSegment::LLNormalTextSegment( const LLUIColor& color, S32 start, S32 end, LLTextBase& editor, bool is_visible)
: LLTextSegment(start, end),
mToken(NULL),
mEditor(editor)
@@ -3334,7 +3331,7 @@ F32 LLNormalTextSegment::drawClippedSegment(S32 seg_start, S32 seg_end, S32 sele
const LLFontGL* font = mStyle->getFont();
- LLColor4 color = (mEditor.getReadOnly() ? mStyle->getReadOnlyColor() : mStyle->getColor()) % alpha;
+ LLColor4 color = (mEditor.getReadOnly() ? mStyle->getReadOnlyColor() : mStyle->getColor()) % (alpha * mStyle->getAlpha());
if( selection_start > seg_start )
{
@@ -3604,7 +3601,7 @@ LLLabelTextSegment::LLLabelTextSegment( LLStyleConstSP style, S32 start, S32 end
{
}
-LLLabelTextSegment::LLLabelTextSegment( const LLColor4& color, S32 start, S32 end, LLTextBase& editor, bool is_visible)
+LLLabelTextSegment::LLLabelTextSegment( const LLUIColor& color, S32 start, S32 end, LLTextBase& editor, bool is_visible)
: LLNormalTextSegment(color, start, end, editor, is_visible)
{
}
@@ -3628,7 +3625,7 @@ LLEmojiTextSegment::LLEmojiTextSegment(LLStyleConstSP style, S32 start, S32 end,
{
}
-LLEmojiTextSegment::LLEmojiTextSegment(const LLColor4& color, S32 start, S32 end, LLTextBase& editor, bool is_visible)
+LLEmojiTextSegment::LLEmojiTextSegment(const LLUIColor& color, S32 start, S32 end, LLTextBase& editor, bool is_visible)
: LLNormalTextSegment(color, start, end, editor, is_visible)
{
}
@@ -3720,7 +3717,7 @@ bool LLInlineViewSegment::getDimensionsF32(S32 first_char, S32 num_chars, F32& w
}
else
{
- width = mLeftPad + mRightPad + mView->getRect().getWidth();
+ width = (F32)(mLeftPad + mRightPad + mView->getRect().getWidth());
height = mBottomPad + mTopPad + mView->getRect().getHeight();
}
@@ -3871,10 +3868,10 @@ F32 LLImageTextSegment::draw(S32 start, S32 end, S32 selection_start, S32 select
S32 style_image_width = image->getWidth();
// Text is drawn from the top of the draw_rect downward
- S32 text_center = draw_rect.mTop - (draw_rect.getHeight() / 2);
+ S32 text_center = (S32)(draw_rect.mTop - (draw_rect.getHeight() / 2.f));
// Align image to center of draw rect
S32 image_bottom = text_center - (style_image_height / 2);
- image->draw(draw_rect.mLeft, image_bottom,
+ image->draw((S32)draw_rect.mLeft, image_bottom,
style_image_width, style_image_height, color);
const S32 IMAGE_HPAD = 3;
diff --git a/indra/llui/lltextbase.h b/indra/llui/lltextbase.h
index 4120d9ea32..00cf66b134 100644
--- a/indra/llui/lltextbase.h
+++ b/indra/llui/lltextbase.h
@@ -84,8 +84,8 @@ public:
virtual void unlinkFromDocument(class LLTextBase* editor);
virtual void linkToDocument(class LLTextBase* editor);
- virtual const LLColor4& getColor() const;
- //virtual void setColor(const LLColor4 &color);
+ virtual const LLUIColor& getColor() const;
+ //virtual void setColor(const LLUIColor &color);
virtual LLStyleConstSP getStyle() const;
virtual void setStyle(LLStyleConstSP style);
virtual void setToken( LLKeywordToken* token );
@@ -125,7 +125,7 @@ class LLNormalTextSegment : public LLTextSegment
{
public:
LLNormalTextSegment( LLStyleConstSP style, S32 start, S32 end, LLTextBase& editor );
- LLNormalTextSegment( const LLColor4& color, S32 start, S32 end, LLTextBase& editor, bool is_visible = true);
+ LLNormalTextSegment( const LLUIColor& color, S32 start, S32 end, LLTextBase& editor, bool is_visible = true);
virtual ~LLNormalTextSegment();
/*virtual*/ bool getDimensionsF32(S32 first_char, S32 num_chars, F32& width, S32& height) const;
@@ -133,7 +133,7 @@ public:
/*virtual*/ S32 getNumChars(S32 num_pixels, S32 segment_offset, S32 line_offset, S32 max_chars, S32 line_ind) const;
/*virtual*/ F32 draw(S32 start, S32 end, S32 selection_start, S32 selection_end, const LLRectf& draw_rect);
/*virtual*/ bool canEdit() const { return true; }
- /*virtual*/ const LLColor4& getColor() const { return mStyle->getColor(); }
+ /*virtual*/ const LLUIColor& getColor() const { return mStyle->getColor(); }
/*virtual*/ LLStyleConstSP getStyle() const { return mStyle; }
/*virtual*/ void setStyle(LLStyleConstSP style) { mStyle = style; }
/*virtual*/ void setToken( LLKeywordToken* token ) { mToken = token; }
@@ -170,7 +170,7 @@ class LLLabelTextSegment : public LLNormalTextSegment
{
public:
LLLabelTextSegment( LLStyleConstSP style, S32 start, S32 end, LLTextBase& editor );
- LLLabelTextSegment( const LLColor4& color, S32 start, S32 end, LLTextBase& editor, bool is_visible = true);
+ LLLabelTextSegment( const LLUIColor& color, S32 start, S32 end, LLTextBase& editor, bool is_visible = true);
protected:
@@ -184,7 +184,7 @@ class LLEmojiTextSegment : public LLNormalTextSegment
{
public:
LLEmojiTextSegment(LLStyleConstSP style, S32 start, S32 end, LLTextBase& editor);
- LLEmojiTextSegment(const LLColor4& color, S32 start, S32 end, LLTextBase& editor, bool is_visible = true);
+ LLEmojiTextSegment(const LLUIColor& color, S32 start, S32 end, LLTextBase& editor, bool is_visible = true);
bool canEdit() const override { return false; }
bool handleToolTip(S32 x, S32 y, MASK mask) override;
@@ -372,8 +372,8 @@ public:
// LLUICtrl interface
/*virtual*/ bool acceptsTextInput() const override { return !mReadOnly; }
- /*virtual*/ void setColor(const LLColor4& c) override;
- virtual void setReadOnlyColor(const LLColor4 &c);
+ /*virtual*/ void setColor(const LLUIColor& c) override;
+ virtual void setReadOnlyColor(const LLUIColor& c);
/*virtual*/ void onVisibilityChange(bool new_visibility) override;
/*virtual*/ void setValue(const LLSD& value) override;
diff --git a/indra/llui/lltextbox.cpp b/indra/llui/lltextbox.cpp
index 92551b682c..05af36b71e 100644
--- a/indra/llui/lltextbox.cpp
+++ b/indra/llui/lltextbox.cpp
@@ -39,7 +39,7 @@ static LLDefaultChildRegistry::Register<LLTextBox> r("text");
// Compiler optimization, generate extern template
template class LLTextBox* LLView::getChild<class LLTextBox>(
- const std::string& name, bool recurse) const;
+ std::string_view name, bool recurse) const;
LLTextBox::LLTextBox(const LLTextBox::Params& p)
: LLTextBase(p),
diff --git a/indra/llui/lltextbox.h b/indra/llui/lltextbox.h
index c1f829c2b9..a3cde45cd0 100644
--- a/indra/llui/lltextbox.h
+++ b/indra/llui/lltextbox.h
@@ -81,7 +81,7 @@ protected:
// Build time optimization, generate once in .cpp file
#ifndef LLTEXTBOX_CPP
extern template class LLTextBox* LLView::getChild<class LLTextBox>(
- const std::string& name, bool recurse) const;
+ std::string_view name, bool recurse) const;
#endif
#endif
diff --git a/indra/llui/lltexteditor.cpp b/indra/llui/lltexteditor.cpp
index 5d30c1299a..cbbb164cb2 100644
--- a/indra/llui/lltexteditor.cpp
+++ b/indra/llui/lltexteditor.cpp
@@ -71,7 +71,7 @@ static LLDefaultChildRegistry::Register<LLTextEditor> r("simple_text_editor");
// Compiler optimization, generate extern template
template class LLTextEditor* LLView::getChild<class LLTextEditor>(
- const std::string& name, bool recurse) const;
+ std::string_view name, bool recurse) const;
//
// Constants
@@ -2421,17 +2421,17 @@ void LLTextEditor::drawPreeditMarker()
if (mPreeditStandouts[i])
{
gl_rect_2d(preedit_left + preedit_standout_gap,
- text_rect.mBottom + mFont->getDescenderHeight() - 1,
+ text_rect.mBottom + (S32)mFont->getDescenderHeight() - 1,
preedit_right - preedit_standout_gap - 1,
- text_rect.mBottom + mFont->getDescenderHeight() - 1 - preedit_standout_thickness,
+ text_rect.mBottom + (S32)mFont->getDescenderHeight() - 1 - preedit_standout_thickness,
(mCursorColor.get() * preedit_standout_brightness + mWriteableBgColor.get() * (1 - preedit_standout_brightness)).setAlpha(1.0f));
}
else
{
gl_rect_2d(preedit_left + preedit_marker_gap,
- text_rect.mBottom + mFont->getDescenderHeight() - 1,
+ text_rect.mBottom + (S32)mFont->getDescenderHeight() - 1,
preedit_right - preedit_marker_gap - 1,
- text_rect.mBottom + mFont->getDescenderHeight() - 1 - preedit_marker_thickness,
+ text_rect.mBottom + (S32)mFont->getDescenderHeight() - 1 - preedit_marker_thickness,
(mCursorColor.get() * preedit_marker_brightness + mWriteableBgColor.get() * (1 - preedit_marker_brightness)).setAlpha(1.0f));
}
}
diff --git a/indra/llui/lltexteditor.h b/indra/llui/lltexteditor.h
index 6ce08f48b5..47dcadf090 100644
--- a/indra/llui/lltexteditor.h
+++ b/indra/llui/lltexteditor.h
@@ -349,7 +349,7 @@ private:
// Build time optimization, generate once in .cpp file
#ifndef LLTEXTEDITOR_CPP
extern template class LLTextEditor* LLView::getChild<class LLTextEditor>(
- const std::string& name, bool recurse) const;
+ std::string_view name, bool recurse) const;
#endif
#endif // LL_TEXTEDITOR_H
diff --git a/indra/llui/lltextparser.cpp b/indra/llui/lltextparser.cpp
index 097b168106..d4ef77664e 100644
--- a/indra/llui/lltextparser.cpp
+++ b/indra/llui/lltextparser.cpp
@@ -36,6 +36,7 @@
#include "llmath.h"
#include "v4color.h"
#include "lldir.h"
+#include "lluicolor.h"
//
// Member Functions
@@ -80,14 +81,14 @@ S32 LLTextParser::findPattern(const std::string &text, LLSD highlight)
return static_cast<S32>(found);
}
-LLSD LLTextParser::parsePartialLineHighlights(const std::string &text, const LLColor4 &color, EHighlightPosition part, S32 index)
+LLTextParser::parser_out_vec_t LLTextParser::parsePartialLineHighlights(const std::string &text, const LLUIColor& color, EHighlightPosition part, S32 index)
{
loadKeywords();
//evil recursive string atomizer.
- LLSD ret_llsd, start_llsd, middle_llsd, end_llsd;
+ parser_out_vec_t ret_vec, start_vec, middle_vec, end_vec;
- for (S32 i=index;i<mHighlights.size();i++)
+ for (S32 i=index, size = (S32)mHighlights.size();i< size;i++)
{
S32 condition = mHighlights[i]["condition"];
if ((S32)mHighlights[i]["highlight"]==PART && condition!=MATCHES)
@@ -104,72 +105,69 @@ LLSD LLTextParser::parsePartialLineHighlights(const std::string &text, const LLC
EHighlightPosition newpart;
if (start==0)
{
- start_llsd[0]["text"] =text.substr(0,end);
- start_llsd[0]["color"]=mHighlights[i]["color"];
+ if (start_vec.empty())
+ {
+ start_vec.push_back(std::make_pair(text.substr(0, end), LLColor4(mHighlights[i]["color"])));
+ }
+ else
+ {
+ start_vec[0] = std::make_pair(text.substr(0, end), LLColor4(mHighlights[i]["color"]));
+ }
if (end < len)
{
if (part==END || part==WHOLE) newpart=END; else newpart=MIDDLE;
- end_llsd=parsePartialLineHighlights(text.substr( end ),color,newpart,i);
+ end_vec = parsePartialLineHighlights(text.substr( end ),color,newpart,i);
}
}
else
{
if (part==START || part==WHOLE) newpart=START; else newpart=MIDDLE;
- start_llsd=parsePartialLineHighlights(text.substr(0,start),color,newpart,i+1);
+ start_vec = parsePartialLineHighlights(text.substr(0,start),color,newpart,i+1);
if (end < len)
{
- middle_llsd[0]["text"] =text.substr(start,end);
- middle_llsd[0]["color"]=mHighlights[i]["color"];
+ if (middle_vec.empty())
+ {
+ middle_vec.push_back(std::make_pair(text.substr(start, end), LLColor4(mHighlights[i]["color"])));
+ }
+ else
+ {
+ middle_vec[0] = std::make_pair(text.substr(start, end), LLColor4(mHighlights[i]["color"]));
+ }
if (part==END || part==WHOLE) newpart=END; else newpart=MIDDLE;
- end_llsd=parsePartialLineHighlights(text.substr( (start+end) ),color,newpart,i);
+ end_vec = parsePartialLineHighlights(text.substr( (start+end) ),color,newpart,i);
}
else
{
- end_llsd[0]["text"] =text.substr(start,end);
- end_llsd[0]["color"]=mHighlights[i]["color"];
+ if (end_vec.empty())
+ {
+ end_vec.push_back(std::make_pair(text.substr(start, end), LLColor4(mHighlights[i]["color"])));
+ }
+ else
+ {
+ end_vec[0] = std::make_pair(text.substr(start, end), LLColor4(mHighlights[i]["color"]));
+ }
}
}
- S32 retcount=0;
-
- //FIXME These loops should be wrapped into a subroutine.
- for (LLSD::array_iterator iter = start_llsd.beginArray();
- iter != start_llsd.endArray();++iter)
- {
- LLSD highlight = *iter;
- ret_llsd[retcount++]=highlight;
- }
-
- for (LLSD::array_iterator iter = middle_llsd.beginArray();
- iter != middle_llsd.endArray();++iter)
- {
- LLSD highlight = *iter;
- ret_llsd[retcount++]=highlight;
- }
-
- for (LLSD::array_iterator iter = end_llsd.beginArray();
- iter != end_llsd.endArray();++iter)
- {
- LLSD highlight = *iter;
- ret_llsd[retcount++]=highlight;
- }
+ ret_vec.reserve(start_vec.size() + middle_vec.size() + end_vec.size());
+ ret_vec.insert(ret_vec.end(), start_vec.begin(), start_vec.end());
+ ret_vec.insert(ret_vec.end(), middle_vec.begin(), middle_vec.end());
+ ret_vec.insert(ret_vec.end(), end_vec.begin(), end_vec.end());
- return ret_llsd;
+ return ret_vec;
}
}
}
}
//No patterns found. Just send back what was passed in.
- ret_llsd[0]["text"] =text;
- LLSD color_sd = color.getValue();
- ret_llsd[0]["color"]=color_sd;
- return ret_llsd;
+ ret_vec.push_back(std::make_pair(text, color));
+ return ret_vec;
}
bool LLTextParser::parseFullLineHighlights(const std::string &text, LLColor4 *color)
diff --git a/indra/llui/lltextparser.h b/indra/llui/lltextparser.h
index 20fcc07e4c..c5756f9b4c 100644
--- a/indra/llui/lltextparser.h
+++ b/indra/llui/lltextparser.h
@@ -30,6 +30,7 @@
#include "llsd.h"
#include "llsingleton.h"
+#include "lluicolor.h"
class LLUUID;
class LLVector3d;
@@ -45,7 +46,9 @@ public:
typedef enum e_highlight_position { WHOLE, START, MIDDLE, END } EHighlightPosition;
typedef enum e_dialog_action { ACTION_NONE, ACTION_CLOSE, ACTION_ADD, ACTION_COPY, ACTION_UPDATE } EDialogAction;
- LLSD parsePartialLineHighlights(const std::string &text,const LLColor4 &color, EHighlightPosition part=WHOLE, S32 index=0);
+ using parser_out_vec_t = std::vector<std::pair<std::string, LLUIColor>>;
+
+ parser_out_vec_t parsePartialLineHighlights(const std::string &text,const LLUIColor &color, EHighlightPosition part=WHOLE, S32 index=0);
bool parseFullLineHighlights(const std::string &text, LLColor4 *color);
private:
diff --git a/indra/llui/lltoolbar.cpp b/indra/llui/lltoolbar.cpp
index aa48ae048f..5955a28fa3 100644
--- a/indra/llui/lltoolbar.cpp
+++ b/indra/llui/lltoolbar.cpp
@@ -1073,7 +1073,7 @@ bool LLToolBar::handleDragAndDrop(S32 x, S32 y, MASK mask, bool drop,
int orig_rank = getRankFromPosition(dragged_command);
mDragRank = getRankFromPosition(x, y);
// Don't DaD if we're dragging a command on itself
- mDragAndDropTarget = ((orig_rank != RANK_NONE) && ((mDragRank == orig_rank) || ((mDragRank - 1) == orig_rank)));
+ mDragAndDropTarget = (orig_rank == RANK_NONE) || ((mDragRank != orig_rank) && ((mDragRank - 1) != orig_rank));
//LL_INFOS() << "Merov debug : DaD, rank = " << mDragRank << ", dragged uui = " << inv_item->getUUID() << LL_ENDL;
/* Do the following if you want to animate the button itself
LLCommandId dragged_command(inv_item->getUUID());
diff --git a/indra/llui/lltrans.cpp b/indra/llui/lltrans.cpp
index 6c7e472a87..8410031653 100644
--- a/indra/llui/lltrans.cpp
+++ b/indra/llui/lltrans.cpp
@@ -65,7 +65,7 @@ bool LLTrans::parseStrings(LLXMLNodePtr &root, const std::set<std::string>& defa
if (!root->hasName("strings"))
{
LL_ERRS() << "Invalid root node name in " << xml_filename
- << ": was " << root->getName() << ", expected \"strings\"" << LL_ENDL;
+ << ": was " << root->getName()->mString << ", expected \"strings\"" << LL_ENDL;
}
StringTable string_table;
@@ -113,7 +113,7 @@ bool LLTrans::parseLanguageStrings(LLXMLNodePtr &root)
if (!root->hasName("strings"))
{
LL_ERRS() << "Invalid root node name in " << xml_filename
- << ": was " << root->getName() << ", expected \"strings\"" << LL_ENDL;
+ << ": was " << root->getName()->mString << ", expected \"strings\"" << LL_ENDL;
}
StringTable string_table;
@@ -143,7 +143,7 @@ bool LLTrans::parseLanguageStrings(LLXMLNodePtr &root)
static LLTrace::BlockTimerStatHandle FTM_GET_TRANS("Translate string");
//static
-std::string LLTrans::getString(const std::string &xml_desc, const LLStringUtil::format_map_t& msg_args, bool def_string)
+std::string LLTrans::getString(std::string_view xml_desc, const LLStringUtil::format_map_t& msg_args, bool def_string)
{
// Don't care about time as much as call count. Make sure we're not
// calling LLTrans::getString() in an inner loop. JC
@@ -167,12 +167,12 @@ std::string LLTrans::getString(const std::string &xml_desc, const LLStringUtil::
else
{
LL_WARNS_ONCE("configuration") << "Missing String in strings.xml: [" << xml_desc << "]" << LL_ENDL;
- return "MissingString("+xml_desc+")";
+ return "MissingString(" + std::string(xml_desc) + ")";
}
}
//static
-std::string LLTrans::getDefString(const std::string &xml_desc, const LLStringUtil::format_map_t& msg_args)
+std::string LLTrans::getDefString(std::string_view xml_desc, const LLStringUtil::format_map_t& msg_args)
{
template_map_t::iterator iter = sDefaultStringTemplates.find(xml_desc);
if (iter != sDefaultStringTemplates.end())
@@ -187,12 +187,12 @@ std::string LLTrans::getDefString(const std::string &xml_desc, const LLStringUti
else
{
LL_WARNS_ONCE("configuration") << "Missing String in strings.xml: [" << xml_desc << "]" << LL_ENDL;
- return "MissingString(" + xml_desc + ")";
+ return "MissingString(" + std::string(xml_desc) + ")";
}
}
//static
-std::string LLTrans::getString(const std::string &xml_desc, const LLSD& msg_args, bool def_string)
+std::string LLTrans::getString(std::string_view xml_desc, const LLSD& msg_args, bool def_string)
{
// Don't care about time as much as call count. Make sure we're not
// calling LLTrans::getString() in an inner loop. JC
@@ -213,12 +213,12 @@ std::string LLTrans::getString(const std::string &xml_desc, const LLSD& msg_args
else
{
LL_WARNS_ONCE("configuration") << "Missing String in strings.xml: [" << xml_desc << "]" << LL_ENDL;
- return "MissingString("+xml_desc+")";
+ return "MissingString(" + std::string(xml_desc) + ")";
}
}
//static
-std::string LLTrans::getDefString(const std::string &xml_desc, const LLSD& msg_args)
+std::string LLTrans::getDefString(std::string_view xml_desc, const LLSD& msg_args)
{
template_map_t::iterator iter = sDefaultStringTemplates.find(xml_desc);
if (iter != sDefaultStringTemplates.end())
@@ -230,12 +230,12 @@ std::string LLTrans::getDefString(const std::string &xml_desc, const LLSD& msg_a
else
{
LL_WARNS_ONCE("configuration") << "Missing String in strings.xml: [" << xml_desc << "]" << LL_ENDL;
- return "MissingString(" + xml_desc + ")";
+ return "MissingString(" + std::string(xml_desc) + ")";
}
}
//static
-bool LLTrans::findString(std::string &result, const std::string &xml_desc, const LLStringUtil::format_map_t& msg_args)
+bool LLTrans::findString(std::string &result, std::string_view xml_desc, const LLStringUtil::format_map_t& msg_args)
{
LL_PROFILE_ZONE_SCOPED_CATEGORY_UI;
@@ -257,7 +257,7 @@ bool LLTrans::findString(std::string &result, const std::string &xml_desc, const
}
//static
-bool LLTrans::findString(std::string &result, const std::string &xml_desc, const LLSD& msg_args)
+bool LLTrans::findString(std::string &result, std::string_view xml_desc, const LLSD& msg_args)
{
LL_PROFILE_ZONE_SCOPED_CATEGORY_UI;
diff --git a/indra/llui/lltrans.h b/indra/llui/lltrans.h
index 4f38ef9067..3492ed0169 100644
--- a/indra/llui/lltrans.h
+++ b/indra/llui/lltrans.h
@@ -76,12 +76,12 @@ public:
* @param args A list of substrings to replace in the string
* @returns Translated string
*/
- static std::string getString(const std::string &xml_desc, const LLStringUtil::format_map_t& args, bool def_string = false);
- static std::string getDefString(const std::string &xml_desc, const LLStringUtil::format_map_t& args);
- static std::string getString(const std::string &xml_desc, const LLSD& args, bool def_string = false);
- static std::string getDefString(const std::string &xml_desc, const LLSD& args);
- static bool findString(std::string &result, const std::string &xml_desc, const LLStringUtil::format_map_t& args);
- static bool findString(std::string &result, const std::string &xml_desc, const LLSD& args);
+ static std::string getString(std::string_view xml_desc, const LLStringUtil::format_map_t& args, bool def_string = false);
+ static std::string getDefString(std::string_view xml_desc, const LLStringUtil::format_map_t& args);
+ static std::string getString(std::string_view xml_desc, const LLSD& args, bool def_string = false);
+ static std::string getDefString(std::string_view xml_desc, const LLSD& args);
+ static bool findString(std::string &result, std::string_view xml_desc, const LLStringUtil::format_map_t& args);
+ static bool findString(std::string &result, std::string_view xml_desc, const LLSD& args);
// Returns translated string with [COUNT] replaced with a number, following
// special per-language logic for plural nouns. For example, some languages
@@ -94,23 +94,22 @@ public:
* @param xml_desc String's description
* @returns Translated string
*/
- static std::string getString(const std::string &xml_desc, bool def_string = false)
+ static std::string getString(std::string_view xml_desc, bool def_string = false)
{
LLStringUtil::format_map_t empty;
return getString(xml_desc, empty);
}
- static bool findString(std::string &result, const std::string &xml_desc)
+ static bool findString(std::string &result, std::string_view xml_desc)
{
LLStringUtil::format_map_t empty;
return findString(result, xml_desc, empty);
}
- static std::string getKeyboardString(const char* keystring)
+ static std::string getKeyboardString(const std::string_view keystring)
{
- std::string key_str(keystring);
std::string trans_str;
- return findString(trans_str, key_str) ? trans_str : key_str;
+ return findString(trans_str, keystring) ? trans_str : std::string(keystring);
}
// get the default args
@@ -128,7 +127,7 @@ public:
}
private:
- typedef std::map<std::string, LLTransTemplate > template_map_t;
+ typedef std::map<std::string, LLTransTemplate, std::less<>> template_map_t;
static template_map_t sStringTemplates;
static template_map_t sDefaultStringTemplates;
static LLStringUtil::format_map_t sDefaultArgs;
diff --git a/indra/llui/llui.cpp b/indra/llui/llui.cpp
index ba8fe84377..e7dea79eaa 100644
--- a/indra/llui/llui.cpp
+++ b/indra/llui/llui.cpp
@@ -54,6 +54,7 @@
#include "llmenubutton.h"
#include "llloadingindicator.h"
#include "llwindow.h"
+#include "llspellcheck.h"
// for registration
#include "llfiltereditor.h"
@@ -156,7 +157,8 @@ mWindow(NULL), // set later in startup
mRootView(NULL),
mHelpImpl(NULL)
{
- LLRender2D::initParamSingleton(image_provider);
+ LLRender2D::createInstance(image_provider);
+ LLSpellChecker::createInstance();
if ((get_ptr_in_map(mSettingGroups, std::string("config")) == NULL) ||
(get_ptr_in_map(mSettingGroups, std::string("floater")) == NULL) ||
@@ -170,11 +172,11 @@ mHelpImpl(NULL)
LLUICtrl::CommitCallbackRegistry::Registrar& reg = LLUICtrl::CommitCallbackRegistry::defaultRegistrar();
// Callbacks for associating controls with floater visibility:
- reg.add("Floater.Toggle", boost::bind(&LLFloaterReg::toggleInstance, _2, LLSD()));
- reg.add("Floater.ToggleOrBringToFront", boost::bind(&LLFloaterReg::toggleInstanceOrBringToFront, _2, LLSD()));
- reg.add("Floater.Show", boost::bind(&LLFloaterReg::showInstance, _2, LLSD(), false));
- reg.add("Floater.ShowOrBringToFront", boost::bind(&LLFloaterReg::showInstanceOrBringToFront, _2, LLSD()));
- reg.add("Floater.Hide", boost::bind(&LLFloaterReg::hideInstance, _2, LLSD()));
+ reg.add("Floater.Toggle", [](LLUICtrl* ctrl, const LLSD& param) -> void { LLFloaterReg::toggleInstance(param.asStringRef()); });
+ reg.add("Floater.ToggleOrBringToFront", [](LLUICtrl* ctrl, const LLSD& param) -> void { LLFloaterReg::toggleInstanceOrBringToFront(param.asStringRef()); });
+ reg.add("Floater.Show", [](LLUICtrl* ctrl, const LLSD& param) -> void { LLFloaterReg::showInstance(param.asStringRef(), LLSD(), false); });
+ reg.add("Floater.ShowOrBringToFront", [](LLUICtrl* ctrl, const LLSD& param) -> void { LLFloaterReg::showInstanceOrBringToFront(param.asStringRef(), LLSD()); });
+ reg.add("Floater.Hide", [](LLUICtrl* ctrl, const LLSD& param) -> void { LLFloaterReg::hideInstance(param.asStringRef()); });
// Button initialization callback for toggle buttons
reg.add("Button.SetFloaterToggle", boost::bind(&LLButton::setFloaterToggle, _1, _2));
@@ -189,13 +191,19 @@ mHelpImpl(NULL)
reg.add("Button.ToggleFloater", boost::bind(&LLButton::toggleFloaterAndSetToggleState, _1, _2));
// Used by menus along with Floater.Toggle to display visibility as a check-mark
- LLUICtrl::EnableCallbackRegistry::defaultRegistrar().add("Floater.Visible", boost::bind(&LLFloaterReg::instanceVisible, _2, LLSD()));
- LLUICtrl::EnableCallbackRegistry::defaultRegistrar().add("Floater.IsOpen", boost::bind(&LLFloaterReg::instanceVisible, _2, LLSD()));
+ LLUICtrl::EnableCallbackRegistry::defaultRegistrar().add("Floater.Visible", [](LLUICtrl* ctrl, const LLSD& param) -> bool { return LLFloaterReg::instanceVisible(param.asStringRef(), LLSD()); });
+ LLUICtrl::EnableCallbackRegistry::defaultRegistrar().add("Floater.IsOpen", [](LLUICtrl* ctrl, const LLSD& param) -> bool { return LLFloaterReg::instanceVisible(param.asStringRef(), LLSD()); });
// Parse the master list of commands
LLCommandManager::load();
}
+LLUI::~LLUI()
+{
+ LLSpellChecker::deleteSingleton();
+ LLRender2D::deleteSingleton();
+}
+
void LLUI::setPopupFuncs(const add_popup_t& add_popup, const remove_popup_t& remove_popup, const clear_popups_t& clear_popups)
{
mAddPopupFunc = add_popup;
@@ -372,7 +380,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)
@@ -534,7 +542,7 @@ namespace LLInitParam
{
if (control.isProvided() && !control().empty())
{
- updateValue(LLUIColorTable::instance().getColor(control));
+ updateValue(LLUIColorTable::instance().getColor(control()));
}
else
{
diff --git a/indra/llui/llui.h b/indra/llui/llui.h
index 373a358544..375cd539b7 100644
--- a/indra/llui/llui.h
+++ b/indra/llui/llui.h
@@ -112,18 +112,18 @@ class LLImageProviderInterface;
typedef void (*LLUIAudioCallback)(const LLUUID& uuid);
-class LLUI : public LLParamSingleton<LLUI>
+class LLUI : public LLSimpleton<LLUI>
{
+ LOG_CLASS(LLUI);
public:
- typedef std::map<std::string, LLControlGroup*> settings_map_t;
+ typedef std::map<std::string, LLControlGroup*, std::less<> > settings_map_t;
-private:
- LLSINGLETON(LLUI , const settings_map_t &settings,
+ LLUI(const settings_map_t &settings,
LLImageProviderInterface* image_provider,
LLUIAudioCallback audio_callback,
LLUIAudioCallback deferred_audio_callback);
- LOG_CLASS(LLUI);
-public:
+ ~LLUI();
+
//
// Classes
//
@@ -295,7 +295,7 @@ public:
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
- LLControlGroup& getControlControlGroup (const std::string& controlname);
+ LLControlGroup& getControlControlGroup (std::string_view controlname);
F32 getMouseIdleTime() { return mMouseIdleTimer.getElapsedTimeF32(); }
void resetMouseIdleTimer() { mMouseIdleTimer.reset(); }
LLWindow* getWindow() { return mWindow; }
diff --git a/indra/llui/lluicolortable.cpp b/indra/llui/lluicolortable.cpp
index 54f8727fa5..a792cb8103 100644
--- a/indra/llui/lluicolortable.cpp
+++ b/indra/llui/lluicolortable.cpp
@@ -63,7 +63,7 @@ void LLUIColorTable::insertFromParams(const Params& p, string_color_map_t& table
ColorEntryParams color_entry = *it;
if(color_entry.color.value.isChosen())
{
- setColor(color_entry.name, color_entry.color.value, table);
+ setColor(color_entry.name(), color_entry.color.value, table);
}
else
{
@@ -176,7 +176,7 @@ void LLUIColorTable::clear()
clearTable(mUserSetColors);
}
-LLUIColor LLUIColorTable::getColor(const std::string& name, const LLColor4& default_color) const
+LLUIColor LLUIColorTable::getColor(std::string_view name, const LLColor4& default_color) const
{
string_color_map_t::const_iterator iter = mUserSetColors.find(name);
@@ -196,9 +196,63 @@ LLUIColor LLUIColorTable::getColor(const std::string& name, const LLColor4& defa
}
// update user color, loaded colors are parsed on initialization
-void LLUIColorTable::setColor(const std::string& name, const LLColor4& color)
+void LLUIColorTable::setColor(std::string_view name, const LLColor4& color)
{
- setColor(name, color, mUserSetColors);
+ auto it = mUserSetColors.lower_bound(name);
+ if(it != mUserSetColors.end() && !(mUserSetColors.key_comp()(name, it->first)))
+ {
+ it->second = color;
+ }
+ else
+ {
+ string_color_map_t::iterator base_iter = mLoadedColors.find(name);
+ if (base_iter != mLoadedColors.end())
+ {
+ LLColor4 original_color = base_iter->second.get();
+ auto color_handle = mLoadedColors.extract(base_iter);
+ auto new_color_pair = mUserSetColors.insert(std::move(color_handle));
+ new_color_pair.position->second = color;
+ mLoadedColors.emplace(name, LLUIColor(original_color));
+ }
+ else
+ {
+ mUserSetColors.insert(it, std::make_pair(name, color));
+ }
+ }
+}
+
+bool LLUIColorTable::isDefault(std::string_view name) const
+{
+ string_color_map_t::const_iterator base_iter = mLoadedColors.find(name);
+ string_color_map_t::const_iterator user_iter = mUserSetColors.find(name);
+ if (base_iter != mLoadedColors.end())
+ {
+ if(user_iter != mUserSetColors.end())
+ return user_iter->second == base_iter->second;
+
+ return true;
+ }
+ else if (user_iter != mUserSetColors.end()) // user only color ???
+ {
+ return true;
+ }
+
+ return false;
+}
+
+void LLUIColorTable::resetToDefault(std::string_view name)
+{
+ string_color_map_t::iterator iter = mUserSetColors.find(name);
+
+ if (iter != mUserSetColors.end())
+ {
+ auto default_iter = mLoadedColors.find(name);
+
+ if (default_iter != mLoadedColors.end())
+ {
+ iter->second = default_iter->second.get();
+ }
+ }
}
bool LLUIColorTable::loadFromSettings()
@@ -223,18 +277,16 @@ void LLUIColorTable::saveUserSettings() const
{
Params params;
- for(string_color_map_t::const_iterator it = mUserSetColors.begin();
- it != mUserSetColors.end();
- ++it)
+ for (const auto& color_pair : mUserSetColors)
{
// Compare user color value with the default value, skip if equal
- string_color_map_t::const_iterator itd = mLoadedColors.find(it->first);
- if(itd != mLoadedColors.end() && itd->second == it->second)
+ string_color_map_t::const_iterator itd = mLoadedColors.find(color_pair.first);
+ if(itd != mLoadedColors.end() && itd->second == color_pair.second)
continue;
ColorEntryParams color_entry;
- color_entry.name = it->first;
- color_entry.color.value = it->second;
+ color_entry.name = color_pair.first;
+ color_entry.color.value = color_pair.second;
params.color_entries.add(color_entry);
}
@@ -258,7 +310,7 @@ void LLUIColorTable::saveUserSettings() const
}
}
-bool LLUIColorTable::colorExists(const std::string& color_name) const
+bool LLUIColorTable::colorExists(std::string_view color_name) const
{
return ((mLoadedColors.find(color_name) != mLoadedColors.end())
|| (mUserSetColors.find(color_name) != mUserSetColors.end()));
@@ -276,7 +328,7 @@ void LLUIColorTable::clearTable(string_color_map_t& table)
// this method inserts a color into the table if it does not exist
// if the color already exists it changes the color
-void LLUIColorTable::setColor(const std::string& name, const LLColor4& color, string_color_map_t& table)
+void LLUIColorTable::setColor(std::string_view name, const LLColor4& color, string_color_map_t& table)
{
string_color_map_t::iterator it = table.lower_bound(name);
if(it != table.end()
diff --git a/indra/llui/lluicolortable.h b/indra/llui/lluicolortable.h
index 7232077cab..0c6286e5eb 100644
--- a/indra/llui/lluicolortable.h
+++ b/indra/llui/lluicolortable.h
@@ -42,7 +42,7 @@ class LLUIColorTable : public LLSingleton<LLUIColorTable>
LOG_CLASS(LLUIColorTable);
// consider using sorted vector, can be much faster
- typedef std::map<std::string, LLUIColor> string_color_map_t;
+ typedef std::map<std::string, LLUIColor, std::less<>> string_color_map_t;
public:
struct ColorParams : LLInitParam::ChoiceBlock<ColorParams>
@@ -75,13 +75,17 @@ public:
void clear();
// color lookup
- LLUIColor getColor(const std::string& name, const LLColor4& default_color = LLColor4::magenta) const;
+ LLUIColor getColor(std::string_view name, const LLColor4& default_color = LLColor4::magenta) const;
// if the color is in the table, it's value is changed, otherwise it is added
- void setColor(const std::string& name, const LLColor4& color);
+ void setColor(std::string_view name, const LLColor4& color);
// returns true if color_name exists in the table
- bool colorExists(const std::string& color_name) const;
+ bool colorExists(std::string_view color_name) const;
+
+ bool isDefault(std::string_view color_name) const;
+
+ void resetToDefault(std::string_view color_name);
// loads colors from settings files
bool loadFromSettings();
@@ -89,13 +93,16 @@ public:
// saves colors specified by the user to the users skin directory
void saveUserSettings() const;
+ const auto& getLoadedColors() { return mLoadedColors; }
+ const auto& getUserColors() { return mUserSetColors; }
+
private:
bool loadFromFilename(const std::string& filename, string_color_map_t& table);
void insertFromParams(const Params& p, string_color_map_t& table);
void clearTable(string_color_map_t& table);
- void setColor(const std::string& name, const LLColor4& color, string_color_map_t& table);
+ void setColor(std::string_view name, const LLColor4& color, string_color_map_t& table);
string_color_map_t mLoadedColors;
string_color_map_t mUserSetColors;
diff --git a/indra/llui/lluictrl.cpp b/indra/llui/lluictrl.cpp
index 52c5f72a45..cbabb5a933 100644
--- a/indra/llui/lluictrl.cpp
+++ b/indra/llui/lluictrl.cpp
@@ -44,7 +44,7 @@ F32 LLUICtrl::sInactiveControlTransparency = 1.0f;
// Compiler optimization, generate extern template
template class LLUICtrl* LLView::getChild<class LLUICtrl>(
- const std::string& name, bool recurse) const;
+ std::string_view name, bool recurse) const;
LLUICtrl::CallbackParam::CallbackParam()
: name("name"),
@@ -135,7 +135,7 @@ void LLUICtrl::initFromParams(const Params& p)
{
if (p.enabled_controls.enabled.isChosen())
{
- LLControlVariable* control = findControl(p.enabled_controls.enabled);
+ LLControlVariable* control = findControl(p.enabled_controls.enabled());
if (control)
{
setEnabledControlVariable(control);
@@ -149,7 +149,7 @@ void LLUICtrl::initFromParams(const Params& p)
}
else if(p.enabled_controls.disabled.isChosen())
{
- LLControlVariable* control = findControl(p.enabled_controls.disabled);
+ LLControlVariable* control = findControl(p.enabled_controls.disabled());
if (control)
{
setDisabledControlVariable(control);
@@ -166,7 +166,7 @@ void LLUICtrl::initFromParams(const Params& p)
{
if (p.controls_visibility.visible.isChosen())
{
- LLControlVariable* control = findControl(p.controls_visibility.visible);
+ LLControlVariable* control = findControl(p.controls_visibility.visible());
if (control)
{
setMakeVisibleControlVariable(control);
@@ -180,7 +180,7 @@ void LLUICtrl::initFromParams(const Params& p)
}
else if (p.controls_visibility.invisible.isChosen())
{
- LLControlVariable* control = findControl(p.controls_visibility.invisible);
+ LLControlVariable* control = findControl(p.controls_visibility.invisible());
if (control)
{
setMakeInvisibleControlVariable(control);
@@ -1023,7 +1023,7 @@ bool LLUICtrl::getTentative() const
}
// virtual
-void LLUICtrl::setColor(const LLColor4& color)
+void LLUICtrl::setColor(const LLUIColor& color)
{ }
F32 LLUICtrl::getCurrentTransparency()
diff --git a/indra/llui/lluictrl.h b/indra/llui/lluictrl.h
index c56c3c43a4..8cd9950917 100644
--- a/indra/llui/lluictrl.h
+++ b/indra/llui/lluictrl.h
@@ -216,7 +216,7 @@ public:
// selected radio button, etc.). Defaults to no-op.
virtual void clear();
- virtual void setColor(const LLColor4& color);
+ virtual void setColor(const LLUIColor& color);
// Ansariel: Changed to virtual. We might want to change the transparency ourself!
virtual F32 getCurrentTransparency();
@@ -335,7 +335,7 @@ private:
// Build time optimization, generate once in .cpp file
#ifndef LLUICTRL_CPP
extern template class LLUICtrl* LLView::getChild<class LLUICtrl>(
- const std::string& name, bool recurse) const;
+ std::string_view name, bool recurse) const;
#endif
#endif // LL_LLUICTRL_H
diff --git a/indra/llui/lluictrlfactory.h b/indra/llui/lluictrlfactory.h
index a07f9b7dae..75e7e396bc 100644
--- a/indra/llui/lluictrlfactory.h
+++ b/indra/llui/lluictrlfactory.h
@@ -182,10 +182,10 @@ fail:
}
template<class T>
- static T* getDefaultWidget(const std::string& name)
+ static T* getDefaultWidget(std::string_view name)
{
typename T::Params widget_params;
- widget_params.name = name;
+ widget_params.name = std::string(name);
return create<T>(widget_params);
}
diff --git a/indra/llui/llurlentry.cpp b/indra/llui/llurlentry.cpp
index 198441804b..79d2fcd049 100644
--- a/indra/llui/llurlentry.cpp
+++ b/indra/llui/llurlentry.cpp
@@ -239,7 +239,7 @@ std::string LLUrlEntryBase::urlToLabelWithGreyQuery(const std::string &url) cons
return url;
}
LLUriParser up(escapeUrl(url));
- if (up.normalize() == 0)
+ if (up.normalize())
{
std::string label;
up.extractParts();
diff --git a/indra/llui/llurlregistry.cpp b/indra/llui/llurlregistry.cpp
index 3a4ce6a72f..cec1ddfc57 100644
--- a/indra/llui/llurlregistry.cpp
+++ b/indra/llui/llurlregistry.cpp
@@ -221,7 +221,7 @@ bool LLUrlRegistry::findUrl(const std::string &text, LLUrlMatch &match, const LL
if (match_entry == mUrlEntryTrusted)
{
LLUriParser up(url);
- if (up.normalize() == 0)
+ if (up.normalize())
{
url = up.normalizedUri();
}
diff --git a/indra/llui/llview.cpp b/indra/llui/llview.cpp
index 1e72228fee..f2a1e16aad 100644
--- a/indra/llui/llview.cpp
+++ b/indra/llui/llview.cpp
@@ -85,7 +85,7 @@ bool LLView::sIsDrawing = false;
// Compiler optimization, generate extern template
template class LLView* LLView::getChild<class LLView>(
- const std::string& name, bool recurse) const;
+ std::string_view name, bool recurse) const;
static LLDefaultChildRegistry::Register<LLView> r("view");
@@ -729,7 +729,7 @@ void LLView::logMouseEvent()
}
template <typename METHOD, typename CHARTYPE>
-LLView* LLView::childrenHandleCharEvent(const std::string& desc, const METHOD& method,
+LLView* LLView::childrenHandleCharEvent(std::string_view desc, const METHOD& method,
CHARTYPE c, MASK mask)
{
if ( getVisible() && getEnabled() )
@@ -1632,7 +1632,7 @@ bool LLView::hasAncestor(const LLView* parentp) const
//-----------------------------------------------------------------------------
-bool LLView::childHasKeyboardFocus( const std::string& childname ) const
+bool LLView::childHasKeyboardFocus(std::string_view childname) const
{
LLView *focus = dynamic_cast<LLView *>(gFocusMgr.getKeyboardFocus());
@@ -1651,7 +1651,7 @@ bool LLView::childHasKeyboardFocus( const std::string& childname ) const
//-----------------------------------------------------------------------------
-bool LLView::hasChild(const std::string& childname, bool recurse) const
+bool LLView::hasChild(std::string_view childname, bool recurse) const
{
return findChildView(childname, recurse) != NULL;
}
@@ -1659,12 +1659,12 @@ bool LLView::hasChild(const std::string& childname, bool recurse) const
//-----------------------------------------------------------------------------
// getChildView()
//-----------------------------------------------------------------------------
-LLView* LLView::getChildView(const std::string& name, bool recurse) const
+LLView* LLView::getChildView(std::string_view name, bool recurse) const
{
return getChild<LLView>(name, recurse);
}
-LLView* LLView::findChildView(const std::string& name, bool recurse) const
+LLView* LLView::findChildView(std::string_view name, bool recurse) const
{
LL_PROFILE_ZONE_SCOPED_CATEGORY_UI;
@@ -2331,18 +2331,20 @@ LLView* LLView::findSnapEdge(S32& new_edge_val, const LLCoordGL& mouse_dir, ESna
//-----------------------------------------------------------------------------
-LLControlVariable *LLView::findControl(const std::string& name)
+LLControlVariable *LLView::findControl(std::string_view name)
{
+ auto uiInst = LLUI::getInstance();
// parse the name to locate which group it belongs to
std::size_t key_pos= name.find(".");
- if(key_pos!= std::string::npos )
+ if(key_pos != std::string_view::npos )
{
- std::string control_group_key = name.substr(0, key_pos);
+ std::string_view control_group_key = name.substr(0, key_pos);
LLControlVariable* control;
// check if it's in the control group that name indicated
- if(LLUI::getInstance()->mSettingGroups[control_group_key])
+ auto it = uiInst->mSettingGroups.find(control_group_key);
+ if(it != uiInst->mSettingGroups.end() && it->second)
{
- control = LLUI::getInstance()->mSettingGroups[control_group_key]->getControl(name);
+ control = it->second->getControl(name);
if (control)
{
return control;
@@ -2350,7 +2352,7 @@ LLControlVariable *LLView::findControl(const std::string& name)
}
}
- LLControlGroup& control_group = LLUI::getInstance()->getControlControlGroup(name);
+ LLControlGroup& control_group = uiInst->getControlControlGroup(name);
return control_group.getControl(name);
}
diff --git a/indra/llui/llview.h b/indra/llui/llview.h
index ad3b71505d..876bfafaa3 100644
--- a/indra/llui/llview.h
+++ b/indra/llui/llview.h
@@ -341,8 +341,8 @@ public:
S32 getChildCount() const { return (S32)mChildList.size(); }
template<class _Pr3> void sortChildren(_Pr3 _Pred) { mChildList.sort(_Pred); }
bool hasAncestor(const LLView* parentp) const;
- bool hasChild(const std::string& childname, bool recurse = false) const;
- bool childHasKeyboardFocus( const std::string& childname ) const;
+ bool hasChild(std::string_view childname, bool recurse = false) const;
+ bool childHasKeyboardFocus( std::string_view childname ) const;
// these iterators are used for collapsing various tree traversals into for loops
typedef LLTreeDFSIter<LLView, child_list_const_iter_t> tree_iterator_t;
@@ -417,7 +417,7 @@ public:
void screenRectToLocal( const LLRect& screen, LLRect* local ) const;
void localRectToScreen( const LLRect& local, LLRect* screen ) const;
- LLControlVariable *findControl(const std::string& name);
+ LLControlVariable *findControl(std::string_view name);
const child_list_t* getChildList() const { return &mChildList; }
child_list_const_iter_t beginChild() const { return mChildList.begin(); }
@@ -453,24 +453,24 @@ public:
// static method handles NULL pointer too
static std::string getPathname(const LLView*);
- template <class T> T* findChild(const std::string& name, bool recurse = true) const
+ template <class T> T* findChild(std::string_view name, bool recurse = true) const
{
LLView* child = findChildView(name, recurse);
T* result = dynamic_cast<T*>(child);
return result;
}
- template <class T> T* getChild(const std::string& name, bool recurse = true) const;
+ template <class T> T* getChild(std::string_view name, bool recurse = true) const;
- template <class T> T& getChildRef(const std::string& name, bool recurse = true) const
+ template <class T> T& getChildRef(std::string_view name, bool recurse = true) const
{
return *getChild<T>(name, recurse);
}
- virtual LLView* getChildView(const std::string& name, bool recurse = true) const;
- virtual LLView* findChildView(const std::string& name, bool recurse = true) const;
+ virtual LLView* getChildView(std::string_view name, bool recurse = true) const;
+ virtual LLView* findChildView(std::string_view name, bool recurse = true) const;
- template <class T> T* getDefaultWidget(const std::string& name) const
+ template <class T> T* getDefaultWidget(std::string_view name) const
{
LLView* widgetp = getDefaultWidgetContainer().findChildView(name);
return dynamic_cast<T*>(widgetp);
@@ -578,7 +578,7 @@ private:
LLView* childrenHandleMouseEvent(const METHOD& method, S32 x, S32 y, XDATA extra, bool allow_mouse_block = true);
template <typename METHOD, typename CHARTYPE>
- LLView* childrenHandleCharEvent(const std::string& desc, const METHOD& method,
+ LLView* childrenHandleCharEvent(std::string_view desc, const METHOD& method,
CHARTYPE c, MASK mask);
// adapter to blur distinction between handleKey() and handleUnicodeChar()
@@ -698,7 +698,7 @@ struct TypeValues<LLView::EOrientation> : public LLInitParam::TypeValuesHelper<L
};
}
-template <class T> T* LLView::getChild(const std::string& name, bool recurse) const
+template <class T> T* LLView::getChild(std::string_view name, bool recurse) const
{
LLView* child = findChildView(name, recurse);
T* result = dynamic_cast<T*>(child);
@@ -733,7 +733,7 @@ template <class T> T* LLView::getChild(const std::string& name, bool recurse) co
// require explicit specialization. See llbutton.cpp for an example.
#ifndef LLVIEW_CPP
extern template class LLView* LLView::getChild<class LLView>(
- const std::string& name, bool recurse) const;
+ std::string_view name, bool recurse) const;
#endif
#endif //LL_LLVIEW_H
diff --git a/indra/llui/llviewborder.cpp b/indra/llui/llviewborder.cpp
index c1777c972c..d53fd6eb91 100644
--- a/indra/llui/llviewborder.cpp
+++ b/indra/llui/llviewborder.cpp
@@ -73,14 +73,14 @@ LLViewBorder::LLViewBorder(const LLViewBorder::Params& p)
mStyle(p.render_style)
{}
-void LLViewBorder::setColors( const LLColor4& shadow_dark, const LLColor4& highlight_light )
+void LLViewBorder::setColors( const LLUIColor& shadow_dark, const LLUIColor& highlight_light )
{
mShadowDark = shadow_dark;
mHighlightLight = highlight_light;
}
-void LLViewBorder::setColorsExtended( const LLColor4& shadow_light, const LLColor4& shadow_dark,
- const LLColor4& highlight_light, const LLColor4& highlight_dark )
+void LLViewBorder::setColorsExtended( const LLUIColor& shadow_light, const LLUIColor& shadow_dark,
+ const LLUIColor& highlight_light, const LLUIColor& highlight_dark )
{
mShadowDark = shadow_dark;
mShadowLight = shadow_light;
diff --git a/indra/llui/llviewborder.h b/indra/llui/llviewborder.h
index be499bb534..1f118a0d20 100644
--- a/indra/llui/llviewborder.h
+++ b/indra/llui/llviewborder.h
@@ -77,9 +77,9 @@ public:
S32 getBorderWidth() const { return mBorderWidth; }
void setBevel(EBevel bevel) { mBevel = bevel; }
EBevel getBevel() const { return mBevel; }
- void setColors( const LLColor4& shadow_dark, const LLColor4& highlight_light );
- void setColorsExtended( const LLColor4& shadow_light, const LLColor4& shadow_dark,
- const LLColor4& highlight_light, const LLColor4& highlight_dark );
+ void setColors( const LLUIColor& shadow_dark, const LLUIColor& highlight_light );
+ void setColorsExtended( const LLUIColor& shadow_light, const LLUIColor& shadow_dark,
+ const LLUIColor& highlight_light, const LLUIColor& highlight_dark );
void setTexture( const class LLUUID &image_id );
LLColor4 getHighlightLight() {return mHighlightLight.get();}
diff --git a/indra/llui/llviewereventrecorder.cpp b/indra/llui/llviewereventrecorder.cpp
index 1bf3e3c43b..e5e0545dad 100644
--- a/indra/llui/llviewereventrecorder.cpp
+++ b/indra/llui/llviewereventrecorder.cpp
@@ -98,6 +98,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 (!logEvents) return;
LLView * target_view = LLUI::getInstance()->resolvePath(LLUI::getInstance()->getRootView(), xui);
if (! target_view) {
@@ -126,6 +127,8 @@ void LLViewerEventRecorder::updateMouseEventInfo(S32 local_x, S32 local_y, S32 g
void LLViewerEventRecorder::logVisibilityChange(std::string xui, std::string name, bool visibility, std::string event_subtype) {
+ if (!logEvents) return;
+
LLSD event=LLSD::emptyMap();
event.insert("event",LLSD(std::string("visibility")));
@@ -167,6 +170,7 @@ void LLViewerEventRecorder::update_xui(std::string xui) {
void LLViewerEventRecorder::logKeyEvent(KEY key, MASK mask) {
+ if (!logEvents) return;
// NOTE: Event recording only logs keydown events - the viewer itself hides keyup events at a fairly low level in the code and does not appear to care about them anywhere
LLSD event = LLSD::emptyMap();
diff --git a/indra/llui/llvirtualtrackball.cpp b/indra/llui/llvirtualtrackball.cpp
index 8166afc89b..273a1d7bde 100644
--- a/indra/llui/llvirtualtrackball.cpp
+++ b/indra/llui/llvirtualtrackball.cpp
@@ -217,19 +217,19 @@ void LLVirtualTrackball::draw()
S32 halfwidth = mTouchArea->getRect().getWidth() / 2;
S32 halfheight = mTouchArea->getRect().getHeight() / 2;
- draw_point.mV[VX] = (draw_point.mV[VX] + 1.0) * halfwidth + mTouchArea->getRect().mLeft;
- draw_point.mV[VY] = (draw_point.mV[VY] + 1.0) * halfheight + mTouchArea->getRect().mBottom;
+ draw_point.mV[VX] = (draw_point.mV[VX] + 1.0f) * halfwidth + mTouchArea->getRect().mLeft;
+ draw_point.mV[VY] = (draw_point.mV[VY] + 1.0f) * halfheight + mTouchArea->getRect().mBottom;
bool upper_hemisphere = (draw_point.mV[VZ] >= 0.f);
mImgSphere->draw(mTouchArea->getRect(), upper_hemisphere ? UI_VERTEX_COLOR : UI_VERTEX_COLOR % 0.5f);
- drawThumb(draw_point.mV[VX], draw_point.mV[VY], mThumbMode, upper_hemisphere);
+ drawThumb((S32)draw_point.mV[VX], (S32)draw_point.mV[VY], mThumbMode, upper_hemisphere);
if (LLView::sDebugRects)
{
gGL.color4fv(LLColor4::red.mV);
- gl_circle_2d(mTouchArea->getRect().getCenterX(), mTouchArea->getRect().getCenterY(), mImgSphere->getWidth() / 2, 60, false);
- gl_circle_2d(draw_point.mV[VX], draw_point.mV[VY], mImgSunFront->getWidth() / 2, 12, false);
+ gl_circle_2d((F32)mTouchArea->getRect().getCenterX(), (F32)mTouchArea->getRect().getCenterY(), (F32)mImgSphere->getWidth() / 2.f, 60, false);
+ gl_circle_2d(draw_point.mV[VX], draw_point.mV[VY], (F32)mImgSunFront->getWidth() / 2.f, 12, false);
}
// hide the direction labels when disabled
@@ -392,20 +392,20 @@ bool LLVirtualTrackball::handleHover(S32 x, S32 y, MASK mask)
{ // trackball (move to roll) mode
LLQuaternion delta;
- F32 rotX = x - mPrevX;
- F32 rotY = y - mPrevY;
+ F32 rotX = (F32)(x - mPrevX);
+ F32 rotY = (F32)(y - mPrevY);
if (abs(rotX) > 1)
{
- F32 direction = (rotX < 0) ? -1 : 1;
- delta.setAngleAxis(mIncrementMouse * abs(rotX), 0, direction, 0); // changing X - rotate around Y axis
+ F32 direction = (rotX < 0) ? -1.f : 1.f;
+ delta.setAngleAxis(mIncrementMouse * abs(rotX), 0.f, direction, 0.f); // changing X - rotate around Y axis
mValue *= delta;
}
if (abs(rotY) > 1)
{
- F32 direction = (rotY < 0) ? 1 : -1; // reverse for Y (value increases from bottom to top)
- delta.setAngleAxis(mIncrementMouse * abs(rotY), direction, 0, 0); // changing Y - rotate around X axis
+ F32 direction = (rotY < 0) ? 1.f : -1.f; // reverse for Y (value increases from bottom to top)
+ delta.setAngleAxis(mIncrementMouse * abs(rotY), direction, 0.f, 0.f); // changing Y - rotate around X axis
mValue *= delta;
}
}
@@ -416,10 +416,10 @@ bool LLVirtualTrackball::handleHover(S32 x, S32 y, MASK mask)
return true; // don't drag outside the circle
}
- F32 radius = mTouchArea->getRect().getWidth() / 2;
- F32 xx = x - mTouchArea->getRect().getCenterX();
- F32 yy = y - mTouchArea->getRect().getCenterY();
- F32 dist = sqrt(pow(xx, 2) + pow(yy, 2));
+ F32 radius = (F32)mTouchArea->getRect().getWidth() / 2.f;
+ F32 xx = (F32)(x - mTouchArea->getRect().getCenterX());
+ F32 yy = (F32)(y - mTouchArea->getRect().getCenterY());
+ F32 dist = (F32)(sqrt(pow(xx, 2) + pow(yy, 2)));
F32 azimuth = llclamp(acosf(xx / dist), 0.0f, F_PI);
F32 altitude = llclamp(acosf(dist / radius), 0.0f, F_PI_BY_TWO);
diff --git a/indra/llui/llwindowshade.cpp b/indra/llui/llwindowshade.cpp
index e48bc94b0a..8131a56288 100644
--- a/indra/llui/llwindowshade.cpp
+++ b/indra/llui/llwindowshade.cpp
@@ -81,8 +81,8 @@ void LLWindowShade::initFromParams(const LLWindowShade::Params& params)
panel_p.background_visible = true;
panel_p.bg_alpha_image = params.bg_image;
panel_p.auto_resize = false;
- LLLayoutPanel* notification_panel = LLUICtrlFactory::create<LLLayoutPanel>(panel_p);
- stackp->addChild(notification_panel);
+ mNotificationsArea = LLUICtrlFactory::create<LLLayoutPanel>(panel_p);
+ stackp->addChild(mNotificationsArea);
panel_p = LLUICtrlFactory::getDefaultParams<LLLayoutPanel>();
panel_p.auto_resize = true;
@@ -92,15 +92,15 @@ void LLWindowShade::initFromParams(const LLWindowShade::Params& params)
panel_p.mouse_opaque = false;
panel_p.background_visible = false;
panel_p.bg_alpha_color = params.shade_color;
- LLLayoutPanel* dummy_panel = LLUICtrlFactory::create<LLLayoutPanel>(panel_p);
- stackp->addChild(dummy_panel);
+ mBackgroundArea = LLUICtrlFactory::create<LLLayoutPanel>(panel_p);
+ stackp->addChild(mBackgroundArea);
layout_p = LLUICtrlFactory::getDefaultParams<LLLayoutStack>();
layout_p.rect = LLRect(0, 30, 800, 0);
layout_p.follows.flags = FOLLOWS_ALL;
layout_p.orientation = LLLayoutStack::HORIZONTAL;
stackp = LLUICtrlFactory::create<LLLayoutStack>(layout_p);
- notification_panel->addChild(stackp);
+ mNotificationsArea->addChild(stackp);
panel_p = LLUICtrlFactory::getDefaultParams<LLLayoutPanel>();
panel_p.rect.height = 30;
@@ -121,7 +121,8 @@ void LLWindowShade::initFromParams(const LLWindowShade::Params& params)
text_p.name = "notification_text";
text_p.use_ellipses = true;
text_p.wrap = true;
- panel->addChild(LLUICtrlFactory::create<LLTextBox>(text_p));
+ mNotificationsText = LLUICtrlFactory::create<LLTextBox>(text_p);
+ panel->addChild(mNotificationsText);
panel_p = LLUICtrlFactory::getDefaultParams<LLLayoutPanel>();
panel_p.auto_resize = false;
@@ -154,11 +155,9 @@ void LLWindowShade::initFromParams(const LLWindowShade::Params& params)
void LLWindowShade::draw()
{
- LLRect message_rect = getChild<LLTextBox>("notification_text")->getTextBoundingRect();
+ LLRect message_rect = mNotificationsText->getTextBoundingRect();
- LLLayoutPanel* notification_area = getChild<LLLayoutPanel>("notification_area");
-
- notification_area->reshape(notification_area->getRect().getWidth(),
+ mNotificationsArea->reshape(mNotificationsArea->getRect().getWidth(),
llclamp(message_rect.getHeight() + 15,
llmax(mFormHeight, MIN_NOTIFICATION_AREA_HEIGHT),
MAX_NOTIFICATION_AREA_HEIGHT));
@@ -176,21 +175,21 @@ void LLWindowShade::draw()
{
hide();
}
- else if (notification_area->getVisibleAmount() < 0.01f)
+ else if (mNotificationsArea->getVisibleAmount() < 0.01f)
{
displayLatestNotification();
}
- if (!notification_area->getVisible() && (notification_area->getVisibleAmount() < 0.001f))
+ if (!mNotificationsArea->getVisible() && (mNotificationsArea->getVisibleAmount() < 0.001f))
{
- getChildRef<LLLayoutPanel>("background_area").setBackgroundVisible(false);
+ mBackgroundArea->setBackgroundVisible(false);
setMouseOpaque(false);
}
}
void LLWindowShade::hide()
{
- getChildRef<LLLayoutPanel>("notification_area").setVisible(false);
+ mNotificationsArea->setVisible(false);
}
void LLWindowShade::onCloseNotification()
@@ -244,13 +243,12 @@ void LLWindowShade::displayLatestNotification()
LLSD payload = notification->getPayload();
LLNotificationFormPtr formp = notification->getForm();
- LLLayoutPanel& notification_area = getChildRef<LLLayoutPanel>("notification_area");
- notification_area.getChild<LLUICtrl>("notification_icon")->setValue(notification->getIcon());
- notification_area.getChild<LLUICtrl>("notification_text")->setValue(notification->getMessage());
- notification_area.getChild<LLUICtrl>("notification_text")->setToolTip(notification->getMessage());
+ mNotificationsArea->getChild<LLUICtrl>("notification_icon")->setValue(notification->getIcon());
+ mNotificationsText->setValue(notification->getMessage());
+ mNotificationsText->setToolTip(notification->getMessage());
LLNotificationForm::EIgnoreType ignore_type = formp->getIgnoreType();
- LLLayoutPanel& form_elements = notification_area.getChildRef<LLLayoutPanel>("form_elements");
+ LLLayoutPanel& form_elements = mNotificationsArea->getChildRef<LLLayoutPanel>("form_elements");
form_elements.deleteAllChildren();
form_elements.reshape(form_elements.getRect().getWidth(), MIN_NOTIFICATION_AREA_HEIGHT);
@@ -355,25 +353,25 @@ void LLWindowShade::displayLatestNotification()
(*it)->translate(0, delta_y);
}
- getChildRef<LLLayoutPanel>("notification_area").setVisible(true);
- getChildRef<LLLayoutPanel>("background_area").setBackgroundVisible(mModal);
+ mNotificationsArea->setVisible(true);
+ mBackgroundArea->setBackgroundVisible(mModal);
setMouseOpaque(mModal);
}
void LLWindowShade::setBackgroundImage(LLUIImage* image)
{
- getChild<LLLayoutPanel>("notification_area")->setTransparentImage(image);
+ mNotificationsArea->setTransparentImage(image);
}
void LLWindowShade::setTextColor(LLColor4 color)
{
- getChild<LLTextBox>("notification_text")->setColor(color);
+ mNotificationsText->setColor(color);
}
bool LLWindowShade::isShown() const
{
- return getChildRef<LLLayoutPanel>("notification_area").getVisible();
+ return mNotificationsArea->getVisible();
}
void LLWindowShade::setCanClose(bool can_close)
diff --git a/indra/llui/llwindowshade.h b/indra/llui/llwindowshade.h
index a401394d78..da29188943 100644
--- a/indra/llui/llwindowshade.h
+++ b/indra/llui/llwindowshade.h
@@ -31,6 +31,9 @@
#include "llnotifications.h"
#include "lluiimage.h"
+class LLLayoutPanel;
+class LLTextBox;
+
class LLWindowShade : public LLUICtrl
{
public:
@@ -68,6 +71,10 @@ private:
void onEnterNotificationText(LLUICtrl* ctrl, const std::string& name);
void onClickIgnore(LLUICtrl* ctrl);
+ LLLayoutPanel* mBackgroundArea = nullptr;
+ LLLayoutPanel* mNotificationsArea = nullptr;
+ LLTextBox* mNotificationsText = nullptr;
+
std::vector<LLNotificationPtr> mNotifications;
LLSD mNotificationResponse;
bool mModal;
diff --git a/indra/llui/llxyvector.cpp b/indra/llui/llxyvector.cpp
index 19bd8465b9..1521823ce2 100644
--- a/indra/llui/llxyvector.cpp
+++ b/indra/llui/llxyvector.cpp
@@ -159,15 +159,15 @@ void drawArrow(S32 tailX, S32 tailY, S32 tipX, S32 tipY, LLColor4 color)
S32 arrowLength = (abs(dx) < ARROW_LENGTH_LONG && abs(dy) < ARROW_LENGTH_LONG) ? ARROW_LENGTH_SHORT : ARROW_LENGTH_LONG;
- F32 theta = std::atan2(dy, dx);
+ F32 theta = (F32)std::atan2(dy, dx);
- F32 rad = ARROW_ANGLE * std::atan(1) * 4 / 180;
+ F32 rad = (F32)(ARROW_ANGLE * std::atan(1) * 4 / 180);
F32 x = tipX - arrowLength * cos(theta + rad);
F32 y = tipY - arrowLength * sin(theta + rad);
- F32 rad2 = -1 * ARROW_ANGLE * std::atan(1) * 4 / 180;
+ F32 rad2 = (F32)(-1 * ARROW_ANGLE * std::atan(1) * 4 / 180);
F32 x2 = tipX - arrowLength * cos(theta + rad2);
F32 y2 = tipY - arrowLength * sin(theta + rad2);
- gl_triangle_2d(tipX, tipY, x, y, x2, y2, color, true);
+ gl_triangle_2d(tipX, tipY, (S32)x, (S32)y, (S32)x2, (S32)y2, color, true);
}
void LLXYVector::draw()
@@ -179,18 +179,18 @@ void LLXYVector::draw()
if (mLogarithmic)
{
- pointX = (log(llabs(mValueX) + 1)) / mLogScaleX;
+ pointX = (S32)((log(llabs(mValueX) + 1)) / mLogScaleX);
pointX *= (mValueX < 0) ? -1 : 1;
pointX += centerX;
- pointY = (log(llabs(mValueY) + 1)) / mLogScaleY;
+ pointY = (S32)((log(llabs(mValueY) + 1)) / mLogScaleY);
pointY *= (mValueY < 0) ? -1 : 1;
pointY += centerY;
}
else // linear
{
- pointX = centerX + (mValueX * mTouchArea->getRect().getWidth() / (2 * mMaxValueX));
- pointY = centerY + (mValueY * mTouchArea->getRect().getHeight() / (2 * mMaxValueY));
+ pointX = centerX + (S32)(mValueX * mTouchArea->getRect().getWidth() / (2 * mMaxValueX));
+ pointY = centerY + (S32)(mValueY * mTouchArea->getRect().getHeight() / (2 * mMaxValueY));
}
// fill
@@ -223,7 +223,7 @@ void LLXYVector::draw()
}
// draw center circle
- gl_circle_2d(centerX, centerY, CENTER_CIRCLE_RADIUS, 12, true);
+ gl_circle_2d((F32)centerX, (F32)centerY, CENTER_CIRCLE_RADIUS, 12, true);
LLView::draw();
}
@@ -232,7 +232,7 @@ void LLXYVector::onEditChange()
{
if (getEnabled())
{
- setValueAndCommit(mXEntry->getValue().asReal(), mYEntry->getValue().asReal());
+ setValueAndCommit((F32)mXEntry->getValue().asReal(), (F32)mYEntry->getValue().asReal());
}
}
@@ -240,7 +240,7 @@ void LLXYVector::setValue(const LLSD& value)
{
if (value.isArray())
{
- setValue(value[0].asReal(), value[1].asReal());
+ setValue((F32)value[0].asReal(), (F32)value[1].asReal());
}
}