summaryrefslogtreecommitdiff
path: root/indra/llui
diff options
context:
space:
mode:
authorLeslie Linden <leslie@lindenlab.com>2012-01-12 10:58:12 -0800
committerLeslie Linden <leslie@lindenlab.com>2012-01-12 10:58:12 -0800
commit50a8fb4d2eee7857fb3a4f3cce6b819e34b1fd82 (patch)
tree38d88e594f82352796574a2ade57bad2423562f4 /indra/llui
parent1307fad7c9f7a1130242a4de7e0144ba4dea6297 (diff)
parent37c68057c92f5a21a3d21b4ac01690a1cf4cf8e4 (diff)
Merge with latest from viewer-experience
Diffstat (limited to 'indra/llui')
-rw-r--r--indra/llui/lltoolbar.cpp9
-rw-r--r--indra/llui/lltoolbar.h1
-rw-r--r--indra/llui/llview.cpp11
3 files changed, 14 insertions, 7 deletions
diff --git a/indra/llui/lltoolbar.cpp b/indra/llui/lltoolbar.cpp
index 7f96c1373c..9b31a6449d 100644
--- a/indra/llui/lltoolbar.cpp
+++ b/indra/llui/lltoolbar.cpp
@@ -151,14 +151,20 @@ void LLToolBar::createContextMenu()
if (menu)
{
menu->setBackgroundColor(LLUIColorTable::instance().getColor("MenuPopupBgColor"));
-
mPopupMenuHandle = menu->getHandle();
+ mRemoveButtonHandle = menu->getChild<LLView>("Remove button")->getHandle();
}
else
{
llwarns << "Unable to load toolbars context menu." << llendl;
}
}
+
+ if (mRemoveButtonHandle.get())
+ {
+ // Disable/Enable the "Remove button" menu item depending on whether or not a button was clicked
+ mRemoveButtonHandle.get()->setEnabled(mRightMouseTargetButton != NULL);
+ }
}
void LLToolBar::initFromParams(const LLToolBar::Params& p)
@@ -401,6 +407,7 @@ BOOL LLToolBar::handleRightMouseDown(S32 x, S32 y, MASK mask)
{
// Determine which button the mouse was over during the click in case the context menu action
// is intended to affect the button.
+ mRightMouseTargetButton = NULL;
BOOST_FOREACH(LLToolBarButton* button, mButtons)
{
LLRect button_rect;
diff --git a/indra/llui/lltoolbar.h b/indra/llui/lltoolbar.h
index 51fe23ddd1..a50c60282c 100644
--- a/indra/llui/lltoolbar.h
+++ b/indra/llui/lltoolbar.h
@@ -271,6 +271,7 @@ private:
LLLayoutStack* mCenteringStack;
LLPanel* mButtonPanel;
LLHandle<class LLContextMenu> mPopupMenuHandle;
+ LLHandle<class LLView> mRemoveButtonHandle;
LLToolBarButton* mRightMouseTargetButton;
diff --git a/indra/llui/llview.cpp b/indra/llui/llview.cpp
index 61c80bab51..e1ee0a5b14 100644
--- a/indra/llui/llview.cpp
+++ b/indra/llui/llview.cpp
@@ -282,9 +282,6 @@ void LLView::moveChildToBackOfTabGroup(LLUICtrl* child)
// virtual
bool LLView::addChild(LLView* child, S32 tab_group)
{
- // NOTE: Changed this to not crash in release mode
- llassert(mInDraw == false);
-
if (!child)
{
return false;
@@ -334,10 +331,11 @@ bool LLView::addChildInBack(LLView* child, S32 tab_group)
// remove the specified child from the view, and set it's parent to NULL.
void LLView::removeChild(LLView* child)
{
- llassert_always(mInDraw == false);
//llassert_always(sDepth == 0); // Avoid re-ordering while drawing; it can cause subtle iterator bugs
if (child->mParentView == this)
{
+ // if we are removing an item we are currently iterating over, that would be bad
+ llassert(child->mInDraw == false);
mChildList.remove( child );
child->mParentView = NULL;
if (child->isCtrl())
@@ -1086,7 +1084,6 @@ void LLView::draw()
void LLView::drawChildren()
{
- mInDraw = true;
if (!mChildList.empty())
{
LLView* rootp = LLUI::getRootView();
@@ -1110,7 +1107,10 @@ void LLView::drawChildren()
LLUI::pushMatrix();
{
LLUI::translate((F32)viewp->getRect().mLeft, (F32)viewp->getRect().mBottom, 0.f);
+ // flag the fact we are in draw here, in case overridden draw() method attempts to remove this widget
+ viewp->mInDraw = true;
viewp->draw();
+ viewp->mInDraw = false;
if (sDebugRects)
{
@@ -1130,7 +1130,6 @@ void LLView::drawChildren()
}
--sDepth;
}
- mInDraw = false;
}
void LLView::dirtyRect()