aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/llui/llview.cpp
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--linden/indra/llui/llview.cpp125
1 files changed, 67 insertions, 58 deletions
diff --git a/linden/indra/llui/llview.cpp b/linden/indra/llui/llview.cpp
index 0b04213..2a62602 100644
--- a/linden/indra/llui/llview.cpp
+++ b/linden/indra/llui/llview.cpp
@@ -325,6 +325,10 @@ void LLView::moveChildToFrontOfTabGroup(LLUICtrl* child)
325 325
326void LLView::addChild(LLView* child, S32 tab_group) 326void LLView::addChild(LLView* child, S32 tab_group)
327{ 327{
328 if (mParentView == child)
329 {
330 llerrs << "Adding view " << child->getName() << " as child of itself" << llendl;
331 }
328 // remove from current parent 332 // remove from current parent
329 if (child->mParentView) 333 if (child->mParentView)
330 { 334 {
@@ -348,6 +352,10 @@ void LLView::addChild(LLView* child, S32 tab_group)
348 352
349void LLView::addChildAtEnd(LLView* child, S32 tab_group) 353void LLView::addChildAtEnd(LLView* child, S32 tab_group)
350{ 354{
355 if (mParentView == child)
356 {
357 llerrs << "Adding view " << child->getName() << " as child of itself" << llendl;
358 }
351 // remove from current parent 359 // remove from current parent
352 if (child->mParentView) 360 if (child->mParentView)
353 { 361 {
@@ -752,18 +760,22 @@ void LLView::setEnabled(BOOL enabled)
752// virtual 760// virtual
753void LLView::setVisible(BOOL visible) 761void LLView::setVisible(BOOL visible)
754{ 762{
755 if( !visible && (gFocusMgr.getTopCtrl() == this) )
756 {
757 gFocusMgr.setTopCtrl( NULL );
758 }
759
760 if ( mVisible != visible ) 763 if ( mVisible != visible )
761 { 764 {
762 // tell all children of this view that the visibility may have changed 765 if( !visible && (gFocusMgr.getTopCtrl() == this) )
763 onVisibilityChange ( visible ); 766 {
764 } 767 gFocusMgr.setTopCtrl( NULL );
768 }
765 769
766 mVisible = visible; 770 mVisible = visible;
771
772 // notify children of visibility change if root, or part of visible hierarchy
773 if (!getParent() || getParent()->isInVisibleChain())
774 {
775 // tell all children of this view that the visibility may have changed
776 onVisibilityChange( visible );
777 }
778 }
767} 779}
768 780
769// virtual 781// virtual
@@ -778,7 +790,7 @@ BOOL LLView::setLabelArg(const LLString& key, const LLString& text)
778 return FALSE; 790 return FALSE;
779} 791}
780 792
781void LLView::onVisibilityChange ( BOOL curVisibilityIn ) 793void LLView::onVisibilityChange ( BOOL new_visibility )
782{ 794{
783 for ( child_list_iter_t child_it = mChildList.begin(); child_it != mChildList.end(); ++child_it) 795 for ( child_list_iter_t child_it = mChildList.begin(); child_it != mChildList.end(); ++child_it)
784 { 796 {
@@ -786,7 +798,7 @@ void LLView::onVisibilityChange ( BOOL curVisibilityIn )
786 // only views that are themselves visible will have their overall visibility affected by their ancestors 798 // only views that are themselves visible will have their overall visibility affected by their ancestors
787 if (viewp->getVisible()) 799 if (viewp->getVisible())
788 { 800 {
789 viewp->onVisibilityChange ( curVisibilityIn ); 801 viewp->onVisibilityChange ( new_visibility );
790 } 802 }
791 } 803 }
792} 804}
@@ -1390,64 +1402,61 @@ LLView* LLView::childrenHandleRightMouseUp(S32 x, S32 y, MASK mask)
1390 1402
1391void LLView::draw() 1403void LLView::draw()
1392{ 1404{
1393 if (getVisible()) 1405 if (sDebugRects)
1394 { 1406 {
1395 if (sDebugRects) 1407 drawDebugRect();
1396 {
1397 drawDebugRect();
1398 1408
1399 // Check for bogus rectangle 1409 // Check for bogus rectangle
1400 if (mRect.mRight <= mRect.mLeft 1410 if (mRect.mRight <= mRect.mLeft
1401 || mRect.mTop <= mRect.mBottom) 1411 || mRect.mTop <= mRect.mBottom)
1402 { 1412 {
1403 llwarns << "Bogus rectangle for " << getName() << " with " << mRect << llendl; 1413 llwarns << "Bogus rectangle for " << getName() << " with " << mRect << llendl;
1404 }
1405 } 1414 }
1415 }
1406 1416
1407 LLRect rootRect = getRootView()->getRect(); 1417 LLRect rootRect = getRootView()->getRect();
1408 LLRect screenRect; 1418 LLRect screenRect;
1409 1419
1410 // draw focused control on top of everything else 1420 // draw focused control on top of everything else
1411 LLView* focus_view = gFocusMgr.getKeyboardFocus(); 1421 LLView* focus_view = gFocusMgr.getKeyboardFocus();
1412 if (focus_view && focus_view->getParent() != this) 1422 if (focus_view && focus_view->getParent() != this)
1413 { 1423 {
1414 focus_view = NULL; 1424 focus_view = NULL;
1415 } 1425 }
1416 1426
1417 for (child_list_reverse_iter_t child_iter = mChildList.rbegin(); child_iter != mChildList.rend(); ++child_iter) 1427 for (child_list_reverse_iter_t child_iter = mChildList.rbegin(); child_iter != mChildList.rend(); ++child_iter)
1418 { 1428 {
1419 LLView *viewp = *child_iter; 1429 LLView *viewp = *child_iter;
1420 ++sDepth; 1430 ++sDepth;
1421 1431
1422 if (viewp->getVisible() && viewp != focus_view) 1432 if (viewp->getVisible() && viewp != focus_view)
1433 {
1434 // Only draw views that are within the root view
1435 localRectToScreen(viewp->getRect(),&screenRect);
1436 if ( rootRect.rectInRect(&screenRect) )
1423 { 1437 {
1424 // Only draw views that are within the root view 1438 glMatrixMode(GL_MODELVIEW);
1425 localRectToScreen(viewp->getRect(),&screenRect); 1439 LLUI::pushMatrix();
1426 if ( rootRect.rectInRect(&screenRect) )
1427 { 1440 {
1428 glMatrixMode(GL_MODELVIEW); 1441 LLUI::translate((F32)viewp->getRect().mLeft, (F32)viewp->getRect().mBottom, 0.f);
1429 LLUI::pushMatrix(); 1442 viewp->draw();
1430 {
1431 LLUI::translate((F32)viewp->getRect().mLeft, (F32)viewp->getRect().mBottom, 0.f);
1432 viewp->draw();
1433 }
1434 LLUI::popMatrix();
1435 } 1443 }
1444 LLUI::popMatrix();
1436 } 1445 }
1437
1438 --sDepth;
1439 } 1446 }
1440 1447
1441 if (focus_view && focus_view->getVisible()) 1448 --sDepth;
1442 { 1449 }
1443 drawChild(focus_view);
1444 }
1445 1450
1446 // HACK 1451 if (focus_view && focus_view->getVisible())
1447 if (sEditingUI && this == sEditingUIView) 1452 {
1448 { 1453 drawChild(focus_view);
1449 drawDebugRect(); 1454 }
1450 } 1455
1456 // HACK
1457 if (sEditingUI && this == sEditingUIView)
1458 {
1459 drawDebugRect();
1451 } 1460 }
1452} 1461}
1453 1462
@@ -1500,13 +1509,13 @@ void LLView::drawDebugRect()
1500 } 1509 }
1501} 1510}
1502 1511
1503void LLView::drawChild(LLView* childp, S32 x_offset, S32 y_offset) 1512void LLView::drawChild(LLView* childp, S32 x_offset, S32 y_offset, BOOL force_draw)
1504{ 1513{
1505 if (childp && childp->getParent() == this) 1514 if (childp && childp->getParent() == this)
1506 { 1515 {
1507 ++sDepth; 1516 ++sDepth;
1508 1517
1509 if (childp->getVisible()) 1518 if (childp->getVisible() || force_draw)
1510 { 1519 {
1511 glMatrixMode(GL_MODELVIEW); 1520 glMatrixMode(GL_MODELVIEW);
1512 LLUI::pushMatrix(); 1521 LLUI::pushMatrix();
@@ -1636,7 +1645,7 @@ void LLView::updateRect()
1636 LLView* viewp = *child_it; 1645 LLView* viewp = *child_it;
1637 if (viewp->getVisible()) 1646 if (viewp->getVisible())
1638 { 1647 {
1639 child_spanning_rect |= viewp->mRect; 1648 child_spanning_rect.unionWith(viewp->mRect);
1640 } 1649 }
1641 } 1650 }
1642 1651