summaryrefslogtreecommitdiff
path: root/indra/llui
diff options
context:
space:
mode:
Diffstat (limited to 'indra/llui')
-rw-r--r--indra/llui/CMakeLists.txt68
-rw-r--r--indra/llui/lldockablefloater.h3
-rw-r--r--indra/llui/llflatlistview.cpp11
-rw-r--r--indra/llui/llflatlistview.h1
-rw-r--r--indra/llui/llfloater.cpp8
-rw-r--r--indra/llui/llfolderview.cpp58
-rw-r--r--indra/llui/llfolderview.h3
-rw-r--r--indra/llui/llfolderviewmodel.h16
-rw-r--r--indra/llui/lllineeditor.cpp18
-rw-r--r--indra/llui/llmenugl.cpp58
-rw-r--r--indra/llui/llmenugl.h3
-rw-r--r--indra/llui/llmultislider.cpp2
-rw-r--r--indra/llui/llscrolllistctrl.cpp38
-rw-r--r--indra/llui/llscrolllistctrl.h6
-rw-r--r--indra/llui/lltabcontainer.cpp5
-rw-r--r--indra/llui/lltextbase.cpp6
-rw-r--r--indra/llui/lltexteditor.cpp31
-rw-r--r--indra/llui/lltexteditor.h2
-rw-r--r--indra/llui/lltoolbar.cpp7
-rw-r--r--indra/llui/llurlentry.cpp1
-rw-r--r--indra/llui/llurlregistry.cpp2
21 files changed, 208 insertions, 139 deletions
diff --git a/indra/llui/CMakeLists.txt b/indra/llui/CMakeLists.txt
index e0579352d3..9108c6143c 100644
--- a/indra/llui/CMakeLists.txt
+++ b/indra/llui/CMakeLists.txt
@@ -6,33 +6,9 @@ include(00-Common)
include(Hunspell)
include(LLCommon)
include(LLImage)
-include(LLInventory)
-include(LLMath)
-include(LLMessage)
include(LLCoreHttp)
-include(LLRender)
include(LLWindow)
include(LLCoreHttp)
-include(LLFileSystem)
-include(LLXML)
-
-include_directories(
- ${LLCOMMON_INCLUDE_DIRS}
- ${LLCOREHTTP_INCLUDE_DIRS}
- ${LLIMAGE_INCLUDE_DIRS}
- ${LLINVENTORY_INCLUDE_DIRS}
- ${LLMATH_INCLUDE_DIRS}
- ${LLMESSAGE_INCLUDE_DIRS}
- ${LLRENDER_INCLUDE_DIRS}
- ${LLWINDOW_INCLUDE_DIRS}
- ${LLFILESYSTEM_INCLUDE_DIRS}
- ${LLXML_INCLUDE_DIRS}
- ${LIBS_PREBUILD_DIR}/include/hunspell
- )
-include_directories(SYSTEM
- ${LLCOMMON_SYSTEM_INCLUDE_DIRS}
- ${LLXML_SYSTEM_INCLUDE_DIRS}
- )
set(llui_SOURCE_FILES
llaccordionctrl.cpp
@@ -260,9 +236,6 @@ set(llui_HEADER_FILES
llxyvector.h
)
-set_source_files_properties(${llui_HEADER_FILES}
- PROPERTIES HEADER_FILE_ONLY TRUE)
-
SET(llurlentry_TEST_DEPENDENCIES
llurlmatch.cpp
llurlregistry.cpp
@@ -276,42 +249,37 @@ set_source_files_properties(llurlentry.cpp
list(APPEND llui_SOURCE_FILES ${llui_HEADER_FILES})
add_library (llui ${llui_SOURCE_FILES})
+target_include_directories( llui INTERFACE ${CMAKE_CURRENT_SOURCE_DIR})
# Libraries on which this library depends, needed for Linux builds
# Sort by high-level to low-level
target_link_libraries(llui
- ${LLRENDER_LIBRARIES}
- ${LLWINDOW_LIBRARIES}
- ${LLIMAGE_LIBRARIES}
- ${LLINVENTORY_LIBRARIES}
- ${LLMESSAGE_LIBRARIES}
- ${LLCOREHTTP_LIBRARIES}
- ${LLFILESYSTEM_LIBRARIES}
- ${LLXUIXML_LIBRARIES}
- ${LLXML_LIBRARIES}
- ${LLMATH_LIBRARIES}
- ${HUNSPELL_LIBRARY}
- ${LLMESSAGE_LIBRARIES}
- ${LLCOMMON_LIBRARIES} # must be after llimage, llwindow, llrender
+ llrender
+ llwindow
+ llimage
+ llinventory
+ llmessage
+ llcorehttp
+ llfilesystem
+ llxml
+ llmath
+ ll::hunspell
+ llcommon
)
# Add tests
if(LL_TESTS)
include(LLAddBuildTest)
+ set(test_libs llmessage llcorehttp llxml llrender llcommon ll::hunspell)
+
SET(llui_TEST_SOURCE_FILES
llurlmatch.cpp
)
+ set_property( SOURCE ${llui_TEST_SOURCE_FILES} PROPERTY LL_TEST_ADDITIONAL_LIBRARIES ${test_libs})
LL_ADD_PROJECT_UNIT_TESTS(llui "${llui_TEST_SOURCE_FILES}")
# INTEGRATION TESTS
- set(test_libs llui llmessage llcorehttp llcommon
- ${HUNSPELL_LIBRARY}
- ${LLCOMMON_LIBRARIES}
- ${BOOST_FIBER_LIBRARY} ${BOOST_CONTEXT_LIBRARY} ${BOOST_SYSTEM_LIBRARY}
- ${WINDOWS_LIBRARIES})
+
if(NOT LINUX)
- if(WINDOWS)
- LL_ADD_INTEGRATION_TEST(llurlentry llurlentry.cpp "imm32;${test_libs}")
- else(WINDOWS)
- LL_ADD_INTEGRATION_TEST(llurlentry llurlentry.cpp "${test_libs}")
- endif(WINDOWS)
+ set(test_libs llui llmessage llcorehttp llxml llrender llcommon ll::hunspell )
+ LL_ADD_INTEGRATION_TEST(llurlentry llurlentry.cpp "${test_libs}")
endif(NOT LINUX)
endif(LL_TESTS)
diff --git a/indra/llui/lldockablefloater.h b/indra/llui/lldockablefloater.h
index 89c9852f4a..5d90b3ef4e 100644
--- a/indra/llui/lldockablefloater.h
+++ b/indra/llui/lldockablefloater.h
@@ -30,6 +30,7 @@
#include "llerror.h"
#include "llfloater.h"
#include "lldockcontrol.h"
+#include <memory>
/**
* Represents floater that can dock.
@@ -131,7 +132,7 @@ protected:
boost::function<BOOL ()> mIsDockedStateForcedCallback;
private:
- std::auto_ptr<LLDockControl> mDockControl;
+ std::unique_ptr<LLDockControl> mDockControl;
LLUIImagePtr mDockTongue;
static LLHandle<LLFloater> sInstanceHandle;
/**
diff --git a/indra/llui/llflatlistview.cpp b/indra/llui/llflatlistview.cpp
index 5e00bf7f45..b13e7389cc 100644
--- a/indra/llui/llflatlistview.cpp
+++ b/indra/llui/llflatlistview.cpp
@@ -505,6 +505,17 @@ LLFlatListView::LLFlatListView(const LLFlatListView::Params& p)
}
};
+LLFlatListView::~LLFlatListView()
+{
+ for (pairs_iterator_t it = mItemPairs.begin(); it != mItemPairs.end(); ++it)
+ {
+ mItemsPanel->removeChild((*it)->first);
+ (*it)->first->die();
+ delete *it;
+ }
+ mItemPairs.clear();
+}
+
// virtual
void LLFlatListView::draw()
{
diff --git a/indra/llui/llflatlistview.h b/indra/llui/llflatlistview.h
index 230ea200d8..d47c1cf333 100644
--- a/indra/llui/llflatlistview.h
+++ b/indra/llui/llflatlistview.h
@@ -299,6 +299,7 @@ public:
virtual S32 notify(const LLSD& info) ;
+ virtual ~LLFlatListView();
protected:
/** Pairs LLpanel representing a single item LLPanel and LLSD associated with it */
diff --git a/indra/llui/llfloater.cpp b/indra/llui/llfloater.cpp
index d413fab270..2303cd24b7 100644
--- a/indra/llui/llfloater.cpp
+++ b/indra/llui/llfloater.cpp
@@ -759,11 +759,13 @@ void LLFloater::closeFloater(bool app_quitting)
}
// now close dependent floater
- for(handle_set_iter_t dependent_it = mDependents.begin();
- dependent_it != mDependents.end(); )
+ while(mDependents.size() > 0)
{
+ handle_set_iter_t dependent_it = mDependents.begin();
LLFloater* floaterp = dependent_it->get();
- dependent_it = mDependents.erase(dependent_it);
+ // normally removeDependentFloater will do this, but in
+ // case floaterp is somehow invalid or orphaned, erase now
+ mDependents.erase(dependent_it);
if (floaterp)
{
floaterp->mDependeeHandle = LLHandle<LLFloater>();
diff --git a/indra/llui/llfolderview.cpp b/indra/llui/llfolderview.cpp
index ea2ca68e47..e1869e8125 100644
--- a/indra/llui/llfolderview.cpp
+++ b/indra/llui/llfolderview.cpp
@@ -163,6 +163,7 @@ LLFolderView::LLFolderView(const Params& p)
: LLFolderViewFolder(p),
mScrollContainer( NULL ),
mPopupMenuHandle(),
+ mMenuFileName(p.options_menu),
mAllowMultiSelect(p.allow_multiselect),
mAllowDrag(p.allow_drag),
mShowEmptyMessage(p.show_empty_message),
@@ -182,6 +183,7 @@ LLFolderView::LLFolderView(const Params& p)
mMinWidth(0),
mDragAndDropThisFrame(FALSE),
mCallbackRegistrar(NULL),
+ mEnableRegistrar(NULL),
mUseEllipses(p.use_ellipses),
mDraggingOverItem(NULL),
mStatusTextBox(NULL),
@@ -244,17 +246,6 @@ LLFolderView::LLFolderView(const Params& p)
mStatusTextBox->setFollowsTop();
addChild(mStatusTextBox);
-
- // make the popup menu available
- llassert(LLMenuGL::sMenuContainer != NULL);
- LLMenuGL* menu = LLUICtrlFactory::getInstance()->createFromFile<LLMenuGL>(p.options_menu, LLMenuGL::sMenuContainer, LLMenuHolderGL::child_registry_t::instance());
- if (!menu)
- {
- menu = LLUICtrlFactory::getDefaultWidget<LLMenuGL>("inventory_menu");
- }
- menu->setBackgroundColor(LLUIColorTable::instance().getColor("MenuPopupBgColor"));
- mPopupMenuHandle = menu->getHandle();
-
mViewModelItem->openItem();
mAreChildrenInited = true; // root folder is a special case due to not being loaded normally, assume that it's inited.
@@ -276,6 +267,7 @@ LLFolderView::~LLFolderView( void )
mStatusTextBox = NULL;
if (mPopupMenuHandle.get()) mPopupMenuHandle.get()->die();
+ mPopupMenuHandle.markDead();
mAutoOpenItems.removeAllNodes();
clearSelection();
@@ -1438,22 +1430,56 @@ BOOL LLFolderView::handleRightMouseDown( S32 x, S32 y, MASK mask )
BOOL handled = childrenHandleRightMouseDown(x, y, mask) != NULL;
S32 count = mSelectedItems.size();
- LLMenuGL* menu = (LLMenuGL*)mPopupMenuHandle.get();
+ LLMenuGL* menu = static_cast<LLMenuGL*>(mPopupMenuHandle.get());
+ if (!menu)
+ {
+ if (mCallbackRegistrar)
+ {
+ mCallbackRegistrar->pushScope();
+ }
+ if (mEnableRegistrar)
+ {
+ mEnableRegistrar->pushScope();
+ }
+ llassert(LLMenuGL::sMenuContainer != NULL);
+ menu = LLUICtrlFactory::getInstance()->createFromFile<LLMenuGL>(mMenuFileName, LLMenuGL::sMenuContainer, LLMenuHolderGL::child_registry_t::instance());
+ if (!menu)
+ {
+ menu = LLUICtrlFactory::getDefaultWidget<LLMenuGL>("inventory_menu");
+ }
+ menu->setBackgroundColor(LLUIColorTable::instance().getColor("MenuPopupBgColor"));
+ mPopupMenuHandle = menu->getHandle();
+ if (mEnableRegistrar)
+ {
+ mEnableRegistrar->popScope();
+ }
+ if (mCallbackRegistrar)
+ {
+ mCallbackRegistrar->popScope();
+ }
+ }
bool hide_folder_menu = mSuppressFolderMenu && isFolderSelected();
- if ((handled
- && ( count > 0 && (hasVisibleChildren()) ) // show menu only if selected items are visible
- && menu ) &&
+ if (menu && (handled
+ && ( count > 0 && (hasVisibleChildren()) )) && // show menu only if selected items are visible
!hide_folder_menu)
{
if (mCallbackRegistrar)
{
mCallbackRegistrar->pushScope();
}
+ if (mEnableRegistrar)
+ {
+ mEnableRegistrar->pushScope();
+ }
updateMenuOptions(menu);
menu->updateParent(LLMenuGL::sMenuContainer);
LLMenuGL::showPopup(this, menu, x, y);
+ if (mEnableRegistrar)
+ {
+ mEnableRegistrar->popScope();
+ }
if (mCallbackRegistrar)
{
mCallbackRegistrar->popScope();
@@ -1531,7 +1557,7 @@ void LLFolderView::deleteAllChildren()
{
closeRenamer();
if (mPopupMenuHandle.get()) mPopupMenuHandle.get()->die();
- mPopupMenuHandle = LLHandle<LLView>();
+ mPopupMenuHandle.markDead();
mScrollContainer = NULL;
mRenameItem = NULL;
mRenamer = NULL;
diff --git a/indra/llui/llfolderview.h b/indra/llui/llfolderview.h
index 6bb5e6c02e..7dfa04828a 100644
--- a/indra/llui/llfolderview.h
+++ b/indra/llui/llfolderview.h
@@ -235,6 +235,7 @@ public:
bool showItemLinkOverlays() { return mShowItemLinkOverlays; }
void setCallbackRegistrar(LLUICtrl::CommitCallbackRegistry::ScopedRegistrar* registrar) { mCallbackRegistrar = registrar; }
+ void setEnableRegistrar(LLUICtrl::EnableCallbackRegistry::ScopedRegistrar* registrar) { mEnableRegistrar = registrar; }
LLPanel* getParentPanel() { return mParentPanel.get(); }
// DEBUG only
@@ -272,6 +273,7 @@ protected:
protected:
LLHandle<LLView> mPopupMenuHandle;
+ std::string mMenuFileName;
selected_items_t mSelectedItems;
bool mKeyboardSelection,
@@ -327,6 +329,7 @@ protected:
LLFolderViewItem* mDraggingOverItem; // See EXT-719
LLUICtrl::CommitCallbackRegistry::ScopedRegistrar* mCallbackRegistrar;
+ LLUICtrl::EnableCallbackRegistry::ScopedRegistrar* mEnableRegistrar;
public:
static F32 sAutoOpenTime;
diff --git a/indra/llui/llfolderviewmodel.h b/indra/llui/llfolderviewmodel.h
index 618169a8fe..c5e027d314 100644
--- a/indra/llui/llfolderviewmodel.h
+++ b/indra/llui/llfolderviewmodel.h
@@ -419,21 +419,15 @@ public:
mFilter(filter)
{}
- virtual ~LLFolderViewModel()
- {
- delete mSorter;
- mSorter = NULL;
- delete mFilter;
- mFilter = NULL;
- }
+ virtual ~LLFolderViewModel() {}
virtual SortType& getSorter() { return *mSorter; }
virtual const SortType& getSorter() const { return *mSorter; }
- virtual void setSorter(const SortType& sorter) { mSorter = new SortType(sorter); requestSortAll(); }
+ virtual void setSorter(const SortType& sorter) { mSorter.reset(new SortType(sorter)); requestSortAll(); }
virtual FilterType& getFilter() { return *mFilter; }
virtual const FilterType& getFilter() const { return *mFilter; }
- virtual void setFilter(const FilterType& filter) { mFilter = new FilterType(filter); }
+ virtual void setFilter(const FilterType& filter) { mFilter.reset(new FilterType(filter)); }
// By default, we assume the content is available. If a network fetch mechanism is implemented for the model,
// this method needs to be overloaded and return the relevant fetch status.
@@ -471,8 +465,8 @@ public:
}
protected:
- SortType* mSorter;
- FilterType* mFilter;
+ std::unique_ptr<SortType> mSorter;
+ std::unique_ptr<FilterType> mFilter;
};
#endif // LLFOLDERVIEWMODEL_H
diff --git a/indra/llui/lllineeditor.cpp b/indra/llui/lllineeditor.cpp
index 33037b5001..940cf398c0 100644
--- a/indra/llui/lllineeditor.cpp
+++ b/indra/llui/lllineeditor.cpp
@@ -209,13 +209,6 @@ LLLineEditor::LLLineEditor(const LLLineEditor::Params& p)
setPrevalidateInput(p.prevalidate_input_callback());
setPrevalidate(p.prevalidate_callback());
-
- llassert(LLMenuGL::sMenuContainer != NULL);
- LLContextMenu* menu = LLUICtrlFactory::instance().createFromFile<LLContextMenu>
- ("menu_text_editor.xml",
- LLMenuGL::sMenuContainer,
- LLMenuHolderGL::child_registry_t::instance());
- setContextMenu(menu);
}
LLLineEditor::~LLLineEditor()
@@ -1567,7 +1560,7 @@ BOOL LLLineEditor::handleKeyHere(KEY key, MASK mask )
KEY_SHIFT != key &&
KEY_CONTROL != key &&
KEY_ALT != key &&
- KEY_CAPSLOCK )
+ KEY_CAPSLOCK != key)
{
deselect();
}
@@ -2637,6 +2630,15 @@ LLWString LLLineEditor::getConvertedText() const
void LLLineEditor::showContextMenu(S32 x, S32 y)
{
LLContextMenu* menu = static_cast<LLContextMenu*>(mContextMenuHandle.get());
+ if (!menu)
+ {
+ llassert(LLMenuGL::sMenuContainer != NULL);
+ menu = LLUICtrlFactory::createFromFile<LLContextMenu>
+ ("menu_text_editor.xml",
+ LLMenuGL::sMenuContainer,
+ LLMenuHolderGL::child_registry_t::instance());
+ setContextMenu(menu);
+ }
if (menu)
{
diff --git a/indra/llui/llmenugl.cpp b/indra/llui/llmenugl.cpp
index 4264028338..5cb840fd61 100644
--- a/indra/llui/llmenugl.cpp
+++ b/indra/llui/llmenugl.cpp
@@ -4087,25 +4087,39 @@ void LLTearOffMenu::closeTearOff()
}
LLContextMenuBranch::LLContextMenuBranch(const LLContextMenuBranch::Params& p)
-: LLMenuItemGL(p),
- mBranch( p.branch()->getHandle() )
+: LLMenuItemGL(p)
{
- mBranch.get()->hide();
- mBranch.get()->setParentMenuItem(this);
+ LLContextMenu* branch = static_cast<LLContextMenu*>(p.branch);
+ if (branch)
+ {
+ mBranch = branch->getHandle();
+ branch->hide();
+ branch->setParentMenuItem(this);
+ }
+}
+
+LLContextMenuBranch::~LLContextMenuBranch()
+{
+ if (mBranch.get())
+ {
+ mBranch.get()->die();
+ }
}
// called to rebuild the draw label
void LLContextMenuBranch::buildDrawLabel( void )
{
+ auto menu = getBranch();
+ if (menu)
{
// default enablement is this -- if any of the subitems are
// enabled, this item is enabled. JC
- U32 sub_count = mBranch.get()->getItemCount();
+ U32 sub_count = menu->getItemCount();
U32 i;
BOOL any_enabled = FALSE;
for (i = 0; i < sub_count; i++)
{
- LLMenuItemGL* item = mBranch.get()->getItem(i);
+ LLMenuItemGL* item = menu->getItem(i);
item->buildDrawLabel();
if (item->getEnabled() && !item->getDrawTextDisabled() )
{
@@ -4127,13 +4141,17 @@ void LLContextMenuBranch::buildDrawLabel( void )
void LLContextMenuBranch::showSubMenu()
{
- LLMenuItemGL* menu_item = mBranch.get()->getParentMenuItem();
- if (menu_item != NULL && menu_item->getVisible())
+ auto menu = getBranch();
+ if(menu)
{
- S32 center_x;
- S32 center_y;
- localPointToScreen(getRect().getWidth(), getRect().getHeight() , &center_x, &center_y);
- mBranch.get()->show(center_x, center_y);
+ LLMenuItemGL* menu_item = menu->getParentMenuItem();
+ if (menu_item != NULL && menu_item->getVisible())
+ {
+ S32 center_x;
+ S32 center_y;
+ localPointToScreen(getRect().getWidth(), getRect().getHeight(), &center_x, &center_y);
+ menu->show(center_x, center_y);
+ }
}
}
@@ -4147,13 +4165,17 @@ void LLContextMenuBranch::setHighlight( BOOL highlight )
{
if (highlight == getHighlight()) return;
LLMenuItemGL::setHighlight(highlight);
- if( highlight )
- {
- showSubMenu();
- }
- else
+ auto menu = getBranch();
+ if (menu)
{
- mBranch.get()->hide();
+ if (highlight)
+ {
+ showSubMenu();
+ }
+ else
+ {
+ menu->hide();
+ }
}
}
diff --git a/indra/llui/llmenugl.h b/indra/llui/llmenugl.h
index abbfd9a24a..f84c4d41eb 100644
--- a/indra/llui/llmenugl.h
+++ b/indra/llui/llmenugl.h
@@ -745,8 +745,7 @@ public:
LLContextMenuBranch(const Params&);
- virtual ~LLContextMenuBranch()
- {}
+ virtual ~LLContextMenuBranch();
// called to rebuild the draw label
virtual void buildDrawLabel( void );
diff --git a/indra/llui/llmultislider.cpp b/indra/llui/llmultislider.cpp
index f89064d59a..604d246f12 100644
--- a/indra/llui/llmultislider.cpp
+++ b/indra/llui/llmultislider.cpp
@@ -92,7 +92,7 @@ LLMultiSlider::LLMultiSlider(const LLMultiSlider::Params& p)
mMouseDownSignal(NULL),
mMouseUpSignal(NULL)
{
- mValue.emptyMap();
+ mValue = LLSD::emptyMap();
mCurSlider = LLStringUtil::null;
if (mOrientation == HORIZONTAL)
diff --git a/indra/llui/llscrolllistctrl.cpp b/indra/llui/llscrolllistctrl.cpp
index 88c1bdc0d5..219667f766 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),
- mPopupMenu(NULL),
mCommentTextView(NULL),
mNumDynamicWidthColumns(0),
mTotalStaticColumnWidth(0),
@@ -348,6 +347,13 @@ LLScrollListCtrl::~LLScrollListCtrl()
mItemList.clear();
clearColumns(); //clears columns and deletes headers
delete mIsFriendSignal;
+
+ auto menu = mPopupMenuHandle.get();
+ if (menu)
+ {
+ menu->die();
+ mPopupMenuHandle.markDead();
+ }
}
@@ -1307,14 +1313,14 @@ LLScrollListItem* LLScrollListCtrl::getItemByLabel(const std::string& label, BOO
}
-BOOL LLScrollListCtrl::selectItemByPrefix(const std::string& target, BOOL case_sensitive)
+BOOL LLScrollListCtrl::selectItemByPrefix(const std::string& target, BOOL case_sensitive, S32 column)
{
- return selectItemByPrefix(utf8str_to_wstring(target), case_sensitive);
+ return selectItemByPrefix(utf8str_to_wstring(target), case_sensitive, column);
}
// Selects first enabled item that has a name where the name's first part matched the target string.
// Returns false if item not found.
-BOOL LLScrollListCtrl::selectItemByPrefix(const LLWString& target, BOOL case_sensitive)
+BOOL LLScrollListCtrl::selectItemByPrefix(const LLWString& target, BOOL case_sensitive, S32 column)
{
BOOL found = FALSE;
@@ -1329,7 +1335,7 @@ BOOL LLScrollListCtrl::selectItemByPrefix(const LLWString& target, BOOL case_sen
{
LLScrollListItem* item = *iter;
// Only select enabled items with matching names
- LLScrollListCell* cellp = item->getColumn(getSearchColumn());
+ LLScrollListCell* cellp = item->getColumn(column == -1 ? getSearchColumn() : column);
BOOL select = cellp ? item->getEnabled() && ('\0' == cellp->getValue().asString()[0]) : FALSE;
if (select)
{
@@ -1352,7 +1358,7 @@ BOOL LLScrollListCtrl::selectItemByPrefix(const LLWString& target, BOOL case_sen
LLScrollListItem* item = *iter;
// Only select enabled items with matching names
- LLScrollListCell* cellp = item->getColumn(getSearchColumn());
+ LLScrollListCell* cellp = item->getColumn(column == -1 ? getSearchColumn() : column);
if (!cellp)
{
continue;
@@ -1997,17 +2003,23 @@ BOOL LLScrollListCtrl::handleRightMouseDown(S32 x, S32 y, MASK mask)
// create the context menu from the XUI file and display it
std::string menu_name = is_group ? "menu_url_group.xml" : "menu_url_agent.xml";
- delete mPopupMenu;
+ auto menu = mPopupMenuHandle.get();
+ if (menu)
+ {
+ menu->die();
+ mPopupMenuHandle.markDead();
+ }
llassert(LLMenuGL::sMenuContainer != NULL);
- mPopupMenu = LLUICtrlFactory::getInstance()->createFromFile<LLContextMenu>(
+ menu = LLUICtrlFactory::getInstance()->createFromFile<LLContextMenu>(
menu_name, LLMenuGL::sMenuContainer, LLMenuHolderGL::child_registry_t::instance());
- if (mPopupMenu)
+ if (menu)
{
+ mPopupMenuHandle = menu->getHandle();
if (mIsFriendSignal)
{
bool isFriend = *(*mIsFriendSignal)(uuid);
- LLView* addFriendButton = mPopupMenu->getChild<LLView>("add_friend");
- LLView* removeFriendButton = mPopupMenu->getChild<LLView>("remove_friend");
+ LLView* addFriendButton = menu->getChild<LLView>("add_friend");
+ LLView* removeFriendButton = menu->getChild<LLView>("remove_friend");
if (addFriendButton && removeFriendButton)
{
@@ -2016,8 +2028,8 @@ BOOL LLScrollListCtrl::handleRightMouseDown(S32 x, S32 y, MASK mask)
}
}
- mPopupMenu->show(x, y);
- LLMenuGL::showPopup(this, mPopupMenu, x, y);
+ menu->show(x, y);
+ LLMenuGL::showPopup(this, menu, x, y);
return TRUE;
}
}
diff --git a/indra/llui/llscrolllistctrl.h b/indra/llui/llscrolllistctrl.h
index 11ee012185..73b4fb036a 100644
--- a/indra/llui/llscrolllistctrl.h
+++ b/indra/llui/llscrolllistctrl.h
@@ -261,8 +261,8 @@ public:
virtual LLScrollListItem* addSimpleElement(const std::string& value, EAddPosition pos = ADD_BOTTOM, const LLSD& id = LLSD());
BOOL selectItemByLabel( const std::string& item, BOOL case_sensitive = TRUE, S32 column = 0 ); // FALSE if item not found
- BOOL selectItemByPrefix(const std::string& target, BOOL case_sensitive = TRUE);
- BOOL selectItemByPrefix(const LLWString& target, BOOL case_sensitive = TRUE);
+ BOOL selectItemByPrefix(const std::string& target, BOOL case_sensitive = TRUE, S32 column = -1);
+ BOOL selectItemByPrefix(const LLWString& target, BOOL case_sensitive = TRUE, S32 column = -1);
LLScrollListItem* getItemByLabel( const std::string& item, BOOL case_sensitive = TRUE, S32 column = 0 );
const std::string getSelectedItemLabel(S32 column = 0) const;
LLSD getSelectedValue();
@@ -528,7 +528,7 @@ private:
S32 mHighlightedItem;
class LLViewBorder* mBorder;
- LLContextMenu *mPopupMenu;
+ LLHandle<LLContextMenu> mPopupMenuHandle;
LLView *mCommentTextView;
diff --git a/indra/llui/lltabcontainer.cpp b/indra/llui/lltabcontainer.cpp
index 0aa7a2d217..8c841540a5 100644
--- a/indra/llui/lltabcontainer.cpp
+++ b/indra/llui/lltabcontainer.cpp
@@ -1442,6 +1442,11 @@ void LLTabContainer::selectLastTab()
void LLTabContainer::selectNextTab()
{
+ if (mTabList.size() == 0)
+ {
+ return;
+ }
+
BOOL tab_has_focus = FALSE;
if (mCurrentTabIdx >= 0 && mTabList[mCurrentTabIdx]->mButton->hasFocus())
{
diff --git a/indra/llui/lltextbase.cpp b/indra/llui/lltextbase.cpp
index 8effd866e0..82a3c01c6d 100644
--- a/indra/llui/lltextbase.cpp
+++ b/indra/llui/lltextbase.cpp
@@ -273,6 +273,12 @@ LLTextBase::LLTextBase(const LLTextBase::Params &p)
LLTextBase::~LLTextBase()
{
mSegments.clear();
+ LLContextMenu* menu = static_cast<LLContextMenu*>(mPopupMenuHandle.get());
+ if (menu)
+ {
+ menu->die();
+ mPopupMenuHandle.markDead();
+ }
delete mURLClickSignal;
delete mIsFriendSignal;
delete mIsObjectBlockedSignal;
diff --git a/indra/llui/lltexteditor.cpp b/indra/llui/lltexteditor.cpp
index b1f8b00cab..3d2a426913 100644
--- a/indra/llui/lltexteditor.cpp
+++ b/indra/llui/lltexteditor.cpp
@@ -257,7 +257,6 @@ LLTextEditor::LLTextEditor(const LLTextEditor::Params& p) :
mMouseDownY(0),
mTabsToNextField(p.ignore_tab),
mPrevalidateFunc(p.prevalidate_callback()),
- mContextMenu(NULL),
mShowContextMenu(p.show_context_menu),
mEnableTooltipPaste(p.enable_tooltip_paste),
mPassDelete(FALSE),
@@ -301,8 +300,13 @@ LLTextEditor::~LLTextEditor()
// Scrollbar is deleted by LLView
std::for_each(mUndoStack.begin(), mUndoStack.end(), DeletePointer());
mUndoStack.clear();
- // context menu is owned by menu holder, not us
- //delete mContextMenu;
+ // Mark the menu as dead or its retained in memory till shutdown.
+ LLContextMenu* menu = static_cast<LLContextMenu*>(mContextMenuHandle.get());
+ if(menu)
+ {
+ menu->die();
+ mContextMenuHandle.markDead();
+ }
}
////////////////////////////////////////////////////////////
@@ -2051,12 +2055,19 @@ void LLTextEditor::setEnabled(BOOL enabled)
void LLTextEditor::showContextMenu(S32 x, S32 y)
{
- if (!mContextMenu)
+ LLContextMenu* menu = static_cast<LLContextMenu*>(mContextMenuHandle.get());
+ if (!menu)
{
llassert(LLMenuGL::sMenuContainer != NULL);
- mContextMenu = LLUICtrlFactory::instance().createFromFile<LLContextMenu>("menu_text_editor.xml",
+ menu = LLUICtrlFactory::createFromFile<LLContextMenu>("menu_text_editor.xml",
LLMenuGL::sMenuContainer,
LLMenuHolderGL::child_registry_t::instance());
+ if(!menu)
+ {
+ LL_WARNS() << "Failed to create menu for LLTextEditor: " << getName() << LL_ENDL;
+ return;
+ }
+ mContextMenuHandle = menu->getHandle();
}
// Route menu to this class
@@ -2102,11 +2113,11 @@ void LLTextEditor::showContextMenu(S32 x, S32 y)
}
}
- mContextMenu->setItemVisible("Suggestion Separator", (use_spellcheck) && (!mSuggestionList.empty()));
- mContextMenu->setItemVisible("Add to Dictionary", (use_spellcheck) && (is_misspelled));
- mContextMenu->setItemVisible("Add to Ignore", (use_spellcheck) && (is_misspelled));
- mContextMenu->setItemVisible("Spellcheck Separator", (use_spellcheck) && (is_misspelled));
- mContextMenu->show(screen_x, screen_y, this);
+ menu->setItemVisible("Suggestion Separator", (use_spellcheck) && (!mSuggestionList.empty()));
+ menu->setItemVisible("Add to Dictionary", (use_spellcheck) && (is_misspelled));
+ menu->setItemVisible("Add to Ignore", (use_spellcheck) && (is_misspelled));
+ menu->setItemVisible("Spellcheck Separator", (use_spellcheck) && (is_misspelled));
+ menu->show(screen_x, screen_y, this);
}
diff --git a/indra/llui/lltexteditor.h b/indra/llui/lltexteditor.h
index 1a10d2fd1e..f3939248c2 100644
--- a/indra/llui/lltexteditor.h
+++ b/indra/llui/lltexteditor.h
@@ -329,7 +329,7 @@ private:
keystroke_signal_t mKeystrokeSignal;
LLTextValidate::validate_func_t mPrevalidateFunc;
- LLContextMenu* mContextMenu;
+ LLHandle<LLContextMenu> mContextMenuHandle;
}; // end class LLTextEditor
// Build time optimization, generate once in .cpp file
diff --git a/indra/llui/lltoolbar.cpp b/indra/llui/lltoolbar.cpp
index 5150df25f2..2707f7a15c 100644
--- a/indra/llui/lltoolbar.cpp
+++ b/indra/llui/lltoolbar.cpp
@@ -127,7 +127,12 @@ LLToolBar::LLToolBar(const LLToolBar::Params& p)
LLToolBar::~LLToolBar()
{
- delete mPopupMenuHandle.get();
+ auto menu = mPopupMenuHandle.get();
+ if (menu)
+ {
+ menu->die();
+ mPopupMenuHandle.markDead();
+ }
delete mButtonAddSignal;
delete mButtonEnterSignal;
delete mButtonLeaveSignal;
diff --git a/indra/llui/llurlentry.cpp b/indra/llui/llurlentry.cpp
index 1547a4ba5c..6a9070634c 100644
--- a/indra/llui/llurlentry.cpp
+++ b/indra/llui/llurlentry.cpp
@@ -206,6 +206,7 @@ bool LLUrlEntryBase::isWikiLinkCorrect(const std::string &labeled_url) const
{
return (chr == L'\u02D0') // "Modifier Letter Colon"
|| (chr == L'\uFF1A') // "Fullwidth Colon"
+ || (chr == L'\u2236') // "Ratio"
|| (chr == L'\uFE55'); // "Small Colon"
},
L'\u003A'); // Colon
diff --git a/indra/llui/llurlregistry.cpp b/indra/llui/llurlregistry.cpp
index c9d7013a11..23f3dca3fb 100644
--- a/indra/llui/llurlregistry.cpp
+++ b/indra/llui/llurlregistry.cpp
@@ -169,7 +169,7 @@ bool LLUrlRegistry::findUrl(const std::string &text, LLUrlMatch &match, const LL
for (it = mUrlEntry.begin(); it != mUrlEntry.end(); ++it)
{
//Skip for url entry icon if content is not trusted
- if(!is_content_trusted && (mUrlEntryIcon == *it))
+ if((mUrlEntryIcon == *it) && ((text.find("Hand") != std::string::npos) || !is_content_trusted))
{
continue;
}