Merge latest fixes from viewer-vob that didn't get into viewer-release yet

master
Ansariel 2016-09-15 23:32:34 +02:00
commit f0366fa155
7 changed files with 62 additions and 47 deletions

View File

@ -2739,14 +2739,19 @@ void LLLineEditor::showContextMenu(S32 x, S32 y)
void LLLineEditor::setContextMenu(LLContextMenu* new_context_menu)
{
if (new_context_menu)
mContextMenuHandle = new_context_menu->getHandle();
else
{
mContextMenuHandle.markDead();
LLContextMenu* menu = static_cast<LLContextMenu*>(mContextMenuHandle.get());
if (menu)
{
menu->die();
mContextMenuHandle.markDead();
// <FS:Ansariel> Delay context menu initialization if LLMenuGL::sMenuContainer is still NULL
mDelayedInit = false;
}
}
if (new_context_menu)
{
mContextMenuHandle = new_context_menu->getHandle();
}
}
void LLLineEditor::setFont(const LLFontGL* font)

View File

@ -278,7 +278,7 @@ public:
void setReplaceNewlinesWithSpaces(BOOL replace);
void setContextMenu(LLContextMenu* new_context_menu);
void resetContextMenu() { setContextMenu(NULL); };
// <FS:Ansariel> Make these protected
void removeChar();
@ -322,6 +322,8 @@ private:
virtual S32 getPreeditFontSize() const;
virtual LLWString getPreeditString() const { return getWText(); }
void setContextMenu(LLContextMenu* new_context_menu);
protected:
LLUIString mText; // The string being edited.
std::string mPrevText; // Saved string for 'ESC' revert

View File

@ -203,7 +203,7 @@ LLTextBase::LLTextBase(const LLTextBase::Params &p)
mMaxTextByteLength( p.max_text_length ),
mFont(p.font),
mFontShadow(p.font_shadow),
mPopupMenu(NULL),
mPopupMenuHandle(),
mReadOnly(p.read_only),
mSpellCheck(p.spellcheck),
mSpellCheckStart(-1),
@ -1372,9 +1372,10 @@ void LLTextBase::setReadOnlyColor(const LLColor4 &c)
//virtual
void LLTextBase::onVisibilityChange( BOOL new_visibility )
{
if(!new_visibility && mPopupMenu)
LLContextMenu* menu = static_cast<LLContextMenu*>(mPopupMenuHandle.get());
if(!new_visibility && menu)
{
mPopupMenu->hide();
menu->hide();
}
LLUICtrl::onVisibilityChange(new_visibility);
}
@ -2104,41 +2105,48 @@ void LLTextBase::createUrlContextMenu(S32 x, S32 y, const std::string &in_url)
// </FS:Ansariel>
// create and return the context menu from the XUI file
delete mPopupMenu;
LLContextMenu* menu = static_cast<LLContextMenu*>(mPopupMenuHandle.get());
if (menu)
{
menu->die();
mPopupMenuHandle.markDead();
}
llassert(LLMenuGL::sMenuContainer != NULL);
mPopupMenu = LLUICtrlFactory::getInstance()->createFromFile<LLContextMenu>(xui_file, LLMenuGL::sMenuContainer,
LLMenuHolderGL::child_registry_t::instance());
if (mIsFriendSignal)
{
bool isFriend = *(*mIsFriendSignal)(LLUUID(LLUrlAction::getUserID(url)));
LLView* addFriendButton = mPopupMenu->getChild<LLView>("add_friend");
LLView* removeFriendButton = mPopupMenu->getChild<LLView>("remove_friend");
menu = LLUICtrlFactory::getInstance()->createFromFile<LLContextMenu>(xui_file, LLMenuGL::sMenuContainer,
LLMenuHolderGL::child_registry_t::instance());
if (menu)
{
mPopupMenuHandle = menu->getHandle();
if (addFriendButton && removeFriendButton)
{
addFriendButton->setEnabled(!isFriend);
removeFriendButton->setEnabled(isFriend);
}
}
if (mIsFriendSignal)
{
bool isFriend = *(*mIsFriendSignal)(LLUUID(LLUrlAction::getUserID(url)));
LLView* addFriendButton = menu->getChild<LLView>("add_friend");
LLView* removeFriendButton = menu->getChild<LLView>("remove_friend");
if (mIsObjectBlockedSignal)
{
bool is_blocked = *(*mIsObjectBlockedSignal)(LLUUID(LLUrlAction::getObjectId(url)), LLUrlAction::getObjectName(url));
LLView* blockButton = mPopupMenu->getChild<LLView>("block_object");
LLView* unblockButton = mPopupMenu->getChild<LLView>("unblock_object");
if (addFriendButton && removeFriendButton)
{
addFriendButton->setEnabled(!isFriend);
removeFriendButton->setEnabled(isFriend);
}
}
if (blockButton && unblockButton)
{
blockButton->setVisible(!is_blocked);
unblockButton->setVisible(is_blocked);
}
}
if (mPopupMenu)
{
mPopupMenu->show(x, y);
LLMenuGL::showPopup(this, mPopupMenu, x, y);
}
if (mIsObjectBlockedSignal)
{
bool is_blocked = *(*mIsObjectBlockedSignal)(LLUUID(LLUrlAction::getObjectId(url)), LLUrlAction::getObjectName(url));
LLView* blockButton = menu->getChild<LLView>("block_object");
LLView* unblockButton = menu->getChild<LLView>("unblock_object");
if (blockButton && unblockButton)
{
blockButton->setVisible(!is_blocked);
unblockButton->setVisible(is_blocked);
}
}
menu->show(x, y);
LLMenuGL::showPopup(this, menu, x, y);
}
}
void LLTextBase::setText(const LLStringExplicit &utf8str, const LLStyle::Params& input_params)

View File

@ -738,7 +738,7 @@ protected:
S32 mMaxTextByteLength; // Maximum length mText is allowed to be in bytes
// support widgets
LLContextMenu* mPopupMenu;
LLHandle<LLContextMenu> mPopupMenuHandle;
LLView* mDocumentView;
LLScrollContainer* mScroller;

View File

@ -2003,15 +2003,15 @@ bool LLAppearanceMgr::getCanReplaceCOF(const LLUUID& outfit_cat_id)
return false;
}
// Check whether the outfit contains any wearables we aren't wearing already (STORM-702).
// Check whether the outfit contains any wearables
LLInventoryModel::cat_array_t cats;
LLInventoryModel::item_array_t items;
LLFindWearablesEx is_worn(/*is_worn=*/ false, /*include_body_parts=*/ true);
LLFindWearables is_wearable;
gInventory.collectDescendentsIf(outfit_cat_id,
cats,
items,
LLInventoryModel::EXCLUDE_TRASH,
is_worn);
is_wearable);
return items.size() > 0;
}

View File

@ -255,7 +255,7 @@ LLLocationInputCtrl::LLLocationInputCtrl(const LLLocationInputCtrl::Params& p)
params.commit_on_focus_lost(false);
params.follows.flags(FOLLOWS_ALL);
mTextEntry = LLUICtrlFactory::create<LLURLLineEditor>(params);
mTextEntry->setContextMenu(NULL);
mTextEntry->resetContextMenu();
addChild(mTextEntry);
// LLLineEditor is replaced with LLLocationLineEditor

View File

@ -1011,7 +1011,7 @@ void LLOutfitGallery::refreshOutfit(const LLUUID& category_id)
}
}
if (mGalleryCreated)
if (mGalleryCreated && !LLApp::isQuitting())
{
reArrangeRows();
}