From fac0b6836a59681443fb2bbd13e6b5eb9c07cef5 Mon Sep 17 00:00:00 2001 From: richard Date: Thu, 5 Nov 2009 20:36:15 -0800 Subject: refactored top level ui into main_view.xml --- indra/newview/llviewerwindow.cpp | 177 ++++++++++++++------------------------- 1 file changed, 62 insertions(+), 115 deletions(-) (limited to 'indra/newview/llviewerwindow.cpp') diff --git a/indra/newview/llviewerwindow.cpp b/indra/newview/llviewerwindow.cpp index 9b3dbcd2f6..8630369971 100644 --- a/indra/newview/llviewerwindow.cpp +++ b/indra/newview/llviewerwindow.cpp @@ -1373,6 +1373,10 @@ void LLViewerWindow::initGLDefaults() gCylinder.prerender(); } +struct MainPanel : public LLPanel +{ +}; + void LLViewerWindow::initBase() { S32 height = getWindowHeight(); @@ -1396,30 +1400,15 @@ void LLViewerWindow::initBase() // Create the floater view at the start so that other views can add children to it. // (But wait to add it as a child of the root view so that it will be in front of the // other views.) + MainPanel* main_view = new MainPanel(); + LLUICtrlFactory::instance().buildPanel(main_view, "main_view.xml"); + main_view->setShape(full_window); + getRootView()->addChild(main_view); // Constrain floaters to inside the menu and status bar regions. - LLRect floater_view_rect = full_window; - // make space for menu bar - floater_view_rect.mTop -= MENU_BAR_HEIGHT; - - LLFloaterView::Params fvparams; - fvparams.name("Floater View"); - fvparams.rect(floater_view_rect); - fvparams.mouse_opaque(false); - fvparams.follows.flags(FOLLOWS_ALL); - fvparams.tab_stop(false); - gFloaterView = LLUICtrlFactory::create (fvparams); - - LLSnapshotFloaterView::Params snapParams; - snapParams.name("Snapshot Floater View"); - snapParams.rect(full_window); - snapParams.enabled(false); - gSnapshotFloaterView = LLUICtrlFactory::create (snapParams); + gFloaterView = getRootView()->getChild("Floater View"); + gSnapshotFloaterView = getRootView()->getChild("Snapshot Floater View"); - // Snapshot floater must start invisible otherwise it eats all - // the tooltips. JC - gSnapshotFloaterView->setVisible(FALSE); - // Console llassert( !gConsole ); LLConsole::Params cp; @@ -1443,43 +1432,21 @@ void LLViewerWindow::initBase() } #endif - // Debug view over the console - LLDebugView::Params debug_p; - debug_p.name("DebugView"); - debug_p.rect(full_window); - debug_p.follows.flags(FOLLOWS_ALL); - debug_p.visible(true); - gDebugView = LLUICtrlFactory::create(debug_p); - getRootView()->addChild(gDebugView); - - // Add floater view at the end so it will be on top, and give it tab priority over others - getRootView()->addChild(gFloaterView, -1); - getRootView()->addChild(gSnapshotFloaterView); - - // notify above floaters! - LLRect notify_rect = floater_view_rect; - LLNotifyBoxView::Params p; - p.name("notify_container"); - p.rect(notify_rect); - p.mouse_opaque(false); - p.follows.flags(FOLLOWS_ALL); - gNotifyBoxView = LLUICtrlFactory::create (p); - getRootView()->addChild(gNotifyBoxView, -2); - - // View for tooltips - LLToolTipView::Params hvp; - hvp.name("tooltip view"); - hvp.rect(full_window); - hvp.follows.flags(FOLLOWS_ALL); - gToolTipView = LLUICtrlFactory::create(hvp); - gToolTipView->setFollowsAll(); - getRootView()->addChild(gToolTipView); + gDebugView = getRootView()->getChild("DebugView"); + gDebugView->init(); + gNotifyBoxView = getRootView()->getChild("notify_container"); + gToolTipView = getRootView()->getChild("tooltip view"); // Add the progress bar view (startup view), which overrides everything mProgressView = new LLProgressView(full_window); getRootView()->addChild(mProgressView); setShowProgress(FALSE); setProgressCancelButtonVisible(FALSE); + + gMenuHolder = getRootView()->getChild("Menu Holder"); + + LLMenuGL::sMenuContainer = gMenuHolder; + } void LLViewerWindow::initWorldUI() @@ -1488,20 +1455,22 @@ void LLViewerWindow::initWorldUI() S32 width = mRootView->getRect().getWidth(); LLRect full_window(0, height, width, 0); + gIMMgr = LLIMMgr::getInstance(); // side tray - getRootView()->addChild(LLSideTray::getInstance()); + //getRootView()->addChild(LLSideTray::getInstance()); getRootView()->sendChildToFront(gFloaterView); getRootView()->sendChildToFront(gSnapshotFloaterView); // new bottom panel - LLRect rc = LLBottomTray::getInstance()->getRect(); - rc.mLeft = 0; - rc.mRight = mRootView->getRect().getWidth(); - LLBottomTray::getInstance()->reshape(rc.getWidth(),rc.getHeight(),FALSE); - LLBottomTray::getInstance()->setRect(rc); + LLPanel* bottom_tray_container = getRootView()->getChild("bottom_tray_container"); + LLBottomTray* bottom_tray = LLBottomTray::getInstance(); + bottom_tray->setShape(bottom_tray_container->getLocalRect()); + bottom_tray->setFollows(FOLLOWS_ALL); + bottom_tray_container->addChild(bottom_tray); + bottom_tray_container->setVisible(TRUE); // Pre initialize instance communicate instance; // currently needs to happen before initializing chat or IM @@ -1517,17 +1486,6 @@ void LLViewerWindow::initWorldUI() gMorphView = LLUICtrlFactory::create(mvp); getRootView()->addChild(gMorphView); - // Make space for nav bar. - LLNavigationBar* navbar = LLNavigationBar::getInstance(); - LLRect floater_view_rect = gFloaterView->getRect(); - LLRect notify_view_rect = gNotifyBoxView->getRect(); - floater_view_rect.mTop -= navbar->getDefNavBarHeight(); - floater_view_rect.mBottom += LLBottomTray::getInstance()->getRect().getHeight(); - notify_view_rect.mTop -= navbar->getDefNavBarHeight(); - notify_view_rect.mBottom += LLBottomTray::getInstance()->getRect().getHeight(); - gFloaterView->setRect(floater_view_rect); - gNotifyBoxView->setRect(notify_view_rect); - LLWorldMapView::initClass(); // Force gFloaterWorldMap to initialize @@ -1538,22 +1496,22 @@ void LLViewerWindow::initWorldUI() LLFloaterReg::hideInstance("build"); // Status bar - S32 menu_bar_height = gMenuBarView->getRect().getHeight(); - LLRect root_rect = getRootView()->getRect(); - LLRect status_rect(0, root_rect.getHeight(), root_rect.getWidth(), root_rect.getHeight() - menu_bar_height); - gStatusBar = new LLStatusBar(status_rect); - gStatusBar->setFollows(FOLLOWS_LEFT | FOLLOWS_RIGHT | FOLLOWS_TOP); - - gStatusBar->reshape(root_rect.getWidth(), gStatusBar->getRect().getHeight(), TRUE); - gStatusBar->translate(0, root_rect.getHeight() - gStatusBar->getRect().getHeight()); + LLPanel* status_bar_container = getRootView()->getChild("status_bar_container"); + gStatusBar = new LLStatusBar(status_bar_container->getLocalRect()); + gStatusBar->setFollows(FOLLOWS_ALL); // sync bg color with menu bar gStatusBar->setBackgroundColor( gMenuBarView->getBackgroundColor().get() ); + status_bar_container->addChild(gStatusBar); + status_bar_container->setVisible(TRUE); // Navigation bar - navbar->reshape(root_rect.getWidth(), navbar->getRect().getHeight(), TRUE); // *TODO: redundant? - navbar->translate(0, root_rect.getHeight() - menu_bar_height - navbar->getRect().getHeight()); // FIXME - navbar->setBackgroundColor(gMenuBarView->getBackgroundColor().get()); + LLPanel* nav_bar_container = getRootView()->getChild("nav_bar_container"); + LLNavigationBar* navbar = LLNavigationBar::getInstance(); + navbar->setShape(nav_bar_container->getLocalRect()); + navbar->setBackgroundColor(gMenuBarView->getBackgroundColor().get()); + nav_bar_container->addChild(navbar); + nav_bar_container->setVisible(TRUE); if (!gSavedSettings.getBOOL("ShowNavbarNavigationPanel")) { @@ -1585,19 +1543,6 @@ void LLViewerWindow::initWorldUI() LLBottomTray::getInstance()->showGestureButton(FALSE); } - getRootView()->addChild(gStatusBar); - getRootView()->addChild(navbar); - - - //sidetray - //then notify area - //then menu - //getRootView()->sendChildToFront(LLSideTray::getInstance()); - - getRootView()->sendChildToFront(gNotifyBoxView); - // menu holder appears on top to get first pass at all mouse events - getRootView()->sendChildToFront(gMenuHolder); - if ( gHUDView == NULL ) { LLRect hud_rect = full_window; @@ -1611,11 +1556,13 @@ void LLViewerWindow::initWorldUI() getRootView()->addChildInBack(gHUDView); } - // this allows not to see UI elements created while UI initializing after Alt+Tab was pressed during login. EXT-744. - moveProgressViewToFront(); + LLPanel* panel_ssf_container = getRootView()->getChild("stand_stop_flying_container"); + LLPanelStandStopFlying* panel_stand_stop_flying = LLPanelStandStopFlying::getInstance(); + panel_stand_stop_flying->setShape(panel_ssf_container->getLocalRect()); + panel_stand_stop_flying->setFollows(FOLLOWS_ALL); + panel_ssf_container->addChild(panel_stand_stop_flying); + panel_ssf_container->setVisible(TRUE); - // tooltips are always on top - getRootView()->sendChildToFront(gToolTipView); } // Destroy the UI @@ -2327,26 +2274,26 @@ void LLViewerWindow::moveCursorToCenter() void LLViewerWindow::updateBottomTrayRect() { - if(LLBottomTray::instanceExists() && LLSideTray::instanceCreated()) - { - S32 side_tray_width = 0; - if(LLSideTray::getInstance()->getVisible()) - { - side_tray_width = LLSideTray::getInstance()->getTrayWidth(); - } + //if(LLBottomTray::instanceExists() && LLSideTray::instanceCreated()) + //{ + // S32 side_tray_width = 0; + // if(LLSideTray::getInstance()->getVisible()) + // { + // side_tray_width = LLSideTray::getInstance()->getTrayWidth(); + // } - LLBottomTray* bottom_tray = LLBottomTray::getInstance(); - S32 right = llround((F32)mWindowRect.mRight / mDisplayScale.mV[VX]) - side_tray_width; + // LLBottomTray* bottom_tray = LLBottomTray::getInstance(); + // S32 right = llround((F32)mWindowRect.mRight / mDisplayScale.mV[VX]) - side_tray_width; - LLRect rc = bottom_tray->getRect(); - if (right != rc.mRight) - { - rc.mRight = right; - bottom_tray->reshape(rc.getWidth(), rc.getHeight(), FALSE); - bottom_tray->setRect(rc); - mOnBottomTrayWidthChanged(); - } - } + // LLRect rc = bottom_tray->getRect(); + // if (right != rc.mRight) + // { + // rc.mRight = right; + // bottom_tray->reshape(rc.getWidth(), rc.getHeight(), FALSE); + // bottom_tray->setRect(rc); + // mOnBottomTrayWidthChanged(); + // } + //} } ////////////////////////////////////////////////////////////////////// -- cgit v1.2.3 From 4eb72a12a2280d3be6ac556ad80eb953d249e8eb Mon Sep 17 00:00:00 2001 From: richard Date: Mon, 9 Nov 2009 15:29:47 -0800 Subject: data driven layout of top-level UI elements EXT-1219 Side tray slide-out animation cleaned up some layout of bottom tray contents reviewed by James --- indra/newview/llviewerwindow.cpp | 79 +++++++++++++++------------------------- 1 file changed, 30 insertions(+), 49 deletions(-) (limited to 'indra/newview/llviewerwindow.cpp') diff --git a/indra/newview/llviewerwindow.cpp b/indra/newview/llviewerwindow.cpp index 8630369971..b15019f830 100644 --- a/indra/newview/llviewerwindow.cpp +++ b/indra/newview/llviewerwindow.cpp @@ -1405,6 +1405,9 @@ void LLViewerWindow::initBase() main_view->setShape(full_window); getRootView()->addChild(main_view); + // placeholder widget that controls where "world" is rendered + mWorldViewPlaceholder = main_view->getChildView("world_view_rect"); + // Constrain floaters to inside the menu and status bar regions. gFloaterView = getRootView()->getChild("Floater View"); gSnapshotFloaterView = getRootView()->getChild("Snapshot Floater View"); @@ -1458,9 +1461,6 @@ void LLViewerWindow::initWorldUI() gIMMgr = LLIMMgr::getInstance(); - // side tray - //getRootView()->addChild(LLSideTray::getInstance()); - getRootView()->sendChildToFront(gFloaterView); getRootView()->sendChildToFront(gSnapshotFloaterView); @@ -1468,7 +1468,7 @@ void LLViewerWindow::initWorldUI() LLPanel* bottom_tray_container = getRootView()->getChild("bottom_tray_container"); LLBottomTray* bottom_tray = LLBottomTray::getInstance(); bottom_tray->setShape(bottom_tray_container->getLocalRect()); - bottom_tray->setFollows(FOLLOWS_ALL); + bottom_tray->setFollowsAll(); bottom_tray_container->addChild(bottom_tray); bottom_tray_container->setVisible(TRUE); @@ -1498,7 +1498,8 @@ void LLViewerWindow::initWorldUI() // Status bar LLPanel* status_bar_container = getRootView()->getChild("status_bar_container"); gStatusBar = new LLStatusBar(status_bar_container->getLocalRect()); - gStatusBar->setFollows(FOLLOWS_ALL); + gStatusBar->setFollowsAll(); + gStatusBar->setShape(status_bar_container->getLocalRect()); // sync bg color with menu bar gStatusBar->setBackgroundColor( gMenuBarView->getBackgroundColor().get() ); status_bar_container->addChild(gStatusBar); @@ -1559,10 +1560,24 @@ void LLViewerWindow::initWorldUI() LLPanel* panel_ssf_container = getRootView()->getChild("stand_stop_flying_container"); LLPanelStandStopFlying* panel_stand_stop_flying = LLPanelStandStopFlying::getInstance(); panel_stand_stop_flying->setShape(panel_ssf_container->getLocalRect()); - panel_stand_stop_flying->setFollows(FOLLOWS_ALL); + panel_stand_stop_flying->setFollowsAll(); panel_ssf_container->addChild(panel_stand_stop_flying); panel_ssf_container->setVisible(TRUE); + // put sidetray in container + LLPanel* side_tray_container = getRootView()->getChild("side_tray_container"); + LLSideTray* sidetrayp = LLSideTray::getInstance(); + sidetrayp->setShape(side_tray_container->getLocalRect()); + sidetrayp->setFollowsAll(); + side_tray_container->addChild(sidetrayp); + side_tray_container->setVisible(FALSE); + + // put sidetray buttons in their own panel + LLPanel* buttons_panel = sidetrayp->getButtonsPanel(); + LLPanel* buttons_panel_container = getRootView()->getChild("side_bar_tabs"); + buttons_panel->setShape(buttons_panel_container->getLocalRect()); + buttons_panel->setFollowsAll(); + buttons_panel_container->addChild(buttons_panel); } // Destroy the UI @@ -2272,29 +2287,6 @@ void LLViewerWindow::moveCursorToCenter() LLUI::setMousePositionScreen(x, y); } -void LLViewerWindow::updateBottomTrayRect() -{ - //if(LLBottomTray::instanceExists() && LLSideTray::instanceCreated()) - //{ - // S32 side_tray_width = 0; - // if(LLSideTray::getInstance()->getVisible()) - // { - // side_tray_width = LLSideTray::getInstance()->getTrayWidth(); - // } - - // LLBottomTray* bottom_tray = LLBottomTray::getInstance(); - // S32 right = llround((F32)mWindowRect.mRight / mDisplayScale.mV[VX]) - side_tray_width; - - // LLRect rc = bottom_tray->getRect(); - // if (right != rc.mRight) - // { - // rc.mRight = right; - // bottom_tray->reshape(rc.getWidth(), rc.getHeight(), FALSE); - // bottom_tray->setRect(rc); - // mOnBottomTrayWidthChanged(); - // } - //} -} ////////////////////////////////////////////////////////////////////// // @@ -2336,9 +2328,10 @@ void LLViewerWindow::updateUI() { static std::string last_handle_msg; - updateWorldViewRect(); + // animate layout stacks so we have up to date rect for world view + LLLayoutStack::idle(); - updateBottomTrayRect(); + updateWorldViewRect(); LLView::sMouseHandlerMessage.clear(); @@ -2838,32 +2831,20 @@ void LLViewerWindow::updateKeyboardFocus() LLSideTray::getInstance()->highlightFocused(); } +static LLFastTimer::DeclareTimer FTM_UPDATE_WORLD_VIEW("Update World View"); void LLViewerWindow::updateWorldViewRect(bool use_full_window) { - if (!LLSideTray::instanceCreated()) return; + LLFastTimer ft(FTM_UPDATE_WORLD_VIEW); // start off using whole window to render world LLRect new_world_rect = mWindowRect; if (use_full_window == false) { - // pull in right side of world view based on sidetray - LLSideTray* sidetray = LLSideTray::getInstance(); - if (sidetray->getVisible()) - { - new_world_rect.mRight -= llround((F32)sidetray->getTrayWidth() * mDisplayScale.mV[VX]); - } - - // push top of world view below nav bar - if (LLNavigationBar::getInstance()->getVisible()) - { - LLNavigationBar* barp = LLNavigationBar::getInstance(); - LLRect nav_bar_rect; - if(barp->localRectToOtherView(barp->getLocalRect(), &nav_bar_rect, mRootView)) - { - new_world_rect.mTop = llround((F32)LLNavigationBar::getInstance()->getRect().mBottom * mDisplayScale.mV[VY]); - } - } + new_world_rect = mWorldViewPlaceholder->calcScreenRect(); + // clamp to at least a 1x1 rect so we don't try to allocate zero width gl buffers + new_world_rect.mTop = llmax(new_world_rect.mTop, new_world_rect.mBottom + 1); + new_world_rect.mRight = llmax(new_world_rect.mRight, new_world_rect.mLeft + 1); } if (mWorldViewRect != new_world_rect) -- cgit v1.2.3 From 2bc97bd68a774dd373c5688b5dc660abe90b37cc Mon Sep 17 00:00:00 2001 From: richard Date: Mon, 9 Nov 2009 16:01:21 -0800 Subject: renamed LLLayoutStack::idle to LLLayoutStack::updateClass converted mWorldViewPlaceholder to a LLHandle improved layout of panel_bottomtray reviewed by James --- indra/newview/llviewerwindow.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'indra/newview/llviewerwindow.cpp') diff --git a/indra/newview/llviewerwindow.cpp b/indra/newview/llviewerwindow.cpp index b15019f830..5e5aec5cb9 100644 --- a/indra/newview/llviewerwindow.cpp +++ b/indra/newview/llviewerwindow.cpp @@ -1406,7 +1406,7 @@ void LLViewerWindow::initBase() getRootView()->addChild(main_view); // placeholder widget that controls where "world" is rendered - mWorldViewPlaceholder = main_view->getChildView("world_view_rect"); + mWorldViewPlaceholder = main_view->getChildView("world_view_rect")->getHandle(); // Constrain floaters to inside the menu and status bar regions. gFloaterView = getRootView()->getChild("Floater View"); @@ -2329,7 +2329,7 @@ void LLViewerWindow::updateUI() static std::string last_handle_msg; // animate layout stacks so we have up to date rect for world view - LLLayoutStack::idle(); + LLLayoutStack::updateClass(); updateWorldViewRect(); @@ -2839,9 +2839,9 @@ void LLViewerWindow::updateWorldViewRect(bool use_full_window) // start off using whole window to render world LLRect new_world_rect = mWindowRect; - if (use_full_window == false) + if (use_full_window == false && mWorldViewPlaceholder.get()) { - new_world_rect = mWorldViewPlaceholder->calcScreenRect(); + new_world_rect = mWorldViewPlaceholder.get()->calcScreenRect(); // clamp to at least a 1x1 rect so we don't try to allocate zero width gl buffers new_world_rect.mTop = llmax(new_world_rect.mTop, new_world_rect.mBottom + 1); new_world_rect.mRight = llmax(new_world_rect.mRight, new_world_rect.mLeft + 1); -- cgit v1.2.3