refactored top level ui into main_view.xml

master
richard 2009-11-05 20:36:15 -08:00
parent 52b174d316
commit fac0b6836a
14 changed files with 239 additions and 157 deletions

View File

@ -1857,6 +1857,8 @@ void LLFloater::buildButtons()
/////////////////////////////////////////////////////
// LLFloaterView
static LLDefaultChildRegistry::Register<LLFloaterView> r("floater_view");
LLFloaterView::LLFloaterView (const Params& p)
: LLUICtrl (p),
mFocusCycleMode(FALSE),

View File

@ -3247,11 +3247,9 @@ BOOL LLMenuBarGL::handleHover( S32 x, S32 y, MASK mask )
///============================================================================
LLCoordGL LLMenuHolderGL::sContextMenuSpawnPos(S32_MAX, S32_MAX);
LLMenuHolderGL::LLMenuHolderGL()
: LLPanel()
LLMenuHolderGL::LLMenuHolderGL(const LLMenuHolderGL::Params& p)
: LLPanel(p)
{
setName("Menu Holder");
setMouseOpaque(FALSE);
sItemActivationTimer.stop();
mCanHide = TRUE;
}

View File

@ -765,7 +765,9 @@ private:
class LLMenuHolderGL : public LLPanel
{
public:
LLMenuHolderGL();
struct Params : public LLInitParam::Block<Params, LLPanel::Params>
{};
LLMenuHolderGL(const Params& p);
virtual ~LLMenuHolderGL() {}
virtual BOOL hideMenus();

View File

@ -57,6 +57,8 @@ LLToolTipView *gToolTipView = NULL;
// Member functions
//
static LLDefaultChildRegistry::Register<LLToolTipView> register_tooltip_view("tooltip_view");
LLToolTipView::Params::Params()
{
mouse_opaque = false;
@ -142,7 +144,7 @@ void LLToolTipView::drawStickyRect()
//
static LLDefaultChildRegistry::Register<LLToolTip> r("tool_tip");
static LLDefaultChildRegistry::Register<LLToolTip> register_tooltip("tool_tip");
LLToolTip::Params::Params()

View File

@ -71,7 +71,7 @@ LLBottomTray::LLBottomTray(const LLSD&)
//this is to fix a crash that occurs because LLBottomTray is a singleton
//and thus is deleted at the end of the viewers lifetime, but to be cleanly
//destroyed LLBottomTray requires some subsystems that are long gone
LLUI::getRootView()->addChild(this);
//LLUI::getRootView()->addChild(this);
// Necessary for focus movement among child controls
setFocusRoot(TRUE);

View File

@ -55,12 +55,16 @@ LLDebugView* gDebugView = NULL;
//
// Methods
//
static LLDefaultChildRegistry::Register<LLDebugView> r("debug_view");
LLDebugView::LLDebugView(const LLDebugView::Params& p)
: LLView(p)
{}
void LLDebugView::init()
{
LLRect r;
LLRect rect(p.rect);
LLRect rect = getLocalRect();
r.set(10, rect.getHeight() - 100, rect.getWidth()/2, 100);
LLConsole::Params cp;

View File

@ -60,6 +60,8 @@ public:
LLDebugView(const Params&);
~LLDebugView();
void init();
void setStatsVisible(BOOL visible);
LLFastTimerView* mFastTimerView;

View File

@ -101,6 +101,8 @@ S32 BORDER_WIDTH = 6;
const S32 MAX_POSTCARD_DATASIZE = 1024 * 1024; // one megabyte
const S32 MAX_TEXTURE_SIZE = 512 ; //max upload texture size 512 * 512
static LLDefaultChildRegistry::Register<LLSnapshotFloaterView> r("snapshot_floater_view");
///----------------------------------------------------------------------------
/// Class LLSnapshotLivePreview
///----------------------------------------------------------------------------

View File

@ -598,14 +598,11 @@ BOOL LLPanelStandStopFlying::postBuild()
void LLPanelStandStopFlying::setVisible(BOOL visible)
{
//we dont need to show the panel if these buttons are not activated
if (visible && !mStandButton->getVisible() && !mStopFlyingButton->getVisible()) visible = false;
if (gAgent.getCameraMode() == CAMERA_MODE_MOUSELOOK) visible = false;
if (visible)
{
updatePosition();
getParent()->sendChildToFront(this);
}
LLPanel::setVisible(visible);
@ -638,7 +635,7 @@ LLPanelStandStopFlying* LLPanelStandStopFlying::getStandStopFlyingPanel()
LLUICtrlFactory::getInstance()->buildPanel(panel, "panel_stand_stop_flying.xml");
panel->setVisible(FALSE);
LLUI::getRootView()->addChild(panel);
//LLUI::getRootView()->addChild(panel);
llinfos << "Build LLPanelStandStopFlying panel" << llendl;

View File

@ -467,16 +467,6 @@ void set_underclothes_menu_options()
void init_menus()
{
S32 top = gViewerWindow->getRootView()->getRect().getHeight();
S32 width = gViewerWindow->getRootView()->getRect().getWidth();
//
// Main menu bar
//
gMenuHolder = new LLViewerMenuHolderGL();
gMenuHolder->setRect(LLRect(0, top, width, 0));
gMenuHolder->setFollowsAll();
LLMenuGL::sMenuContainer = gMenuHolder;
// Initialize actions
initialize_menus();
@ -7080,6 +7070,11 @@ void handle_test_load_url(void*)
//
// LLViewerMenuHolderGL
//
static LLDefaultChildRegistry::Register<LLViewerMenuHolderGL> r("menu_holder");
LLViewerMenuHolderGL::LLViewerMenuHolderGL(const LLViewerMenuHolderGL::Params& p)
: LLMenuHolderGL(p)
{}
BOOL LLViewerMenuHolderGL::hideMenus()
{
@ -7089,8 +7084,11 @@ BOOL LLViewerMenuHolderGL::hideMenus()
mParcelSelection = NULL;
mObjectSelection = NULL;
gMenuBarView->clearHoverItem();
gMenuBarView->resetMenuTrigger();
if (gMenuBarView)
{
gMenuBarView->clearHoverItem();
gMenuBarView->resetMenuTrigger();
}
return handled;
}

View File

@ -132,6 +132,11 @@ void handle_export_selected( void * );
class LLViewerMenuHolderGL : public LLMenuHolderGL
{
public:
struct Params : public LLInitParam::Block<Params, LLMenuHolderGL::Params>
{};
LLViewerMenuHolderGL(const Params& p);
virtual BOOL hideMenus();
void setParcelSelection(LLSafeHandle<LLParcelSelection> selection);

View File

@ -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<LLFloaterView> (fvparams);
LLSnapshotFloaterView::Params snapParams;
snapParams.name("Snapshot Floater View");
snapParams.rect(full_window);
snapParams.enabled(false);
gSnapshotFloaterView = LLUICtrlFactory::create<LLSnapshotFloaterView> (snapParams);
gFloaterView = getRootView()->getChild<LLFloaterView>("Floater View");
gSnapshotFloaterView = getRootView()->getChild<LLSnapshotFloaterView>("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<LLDebugView>(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<LLNotifyBoxView> (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<LLToolTipView>(hvp);
gToolTipView->setFollowsAll();
getRootView()->addChild(gToolTipView);
gDebugView = getRootView()->getChild<LLDebugView>("DebugView");
gDebugView->init();
gNotifyBoxView = getRootView()->getChild<LLNotifyBoxView>("notify_container");
gToolTipView = getRootView()->getChild<LLToolTipView>("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<LLViewerMenuHolderGL>("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<LLPanel>("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<LLMorphView>(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<LLPanel>("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<LLPanel>("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<LLPanel>("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();
// }
//}
}
//////////////////////////////////////////////////////////////////////

View File

@ -1,24 +1,9 @@
<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
<floater
legacy_header_height="18"
height="440"
height="768"
layout="topleft"
name="floater_aaa"
help_topic="floater_aaa"
save_rect="true"
can_resize="true"
title="ABOUT [APP_NAME]"
width="470">
<text_editor
follows="left|top|right|bottom"
height="400"
layout="topleft"
left="6"
max_length="65536"
name="credits_editor"
top="25"
width="458"
word_wrap="true">
This is line 4
</text_editor>
width="1024">
<panel filename="main_view.xml" follows="all" width="1024" height="768" top="0"/>
</floater>

View File

@ -0,0 +1,138 @@
<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
<panel
follows="left|right|top|bottom"
height="768"
layout="topleft"
left="0"
mouse_opaque="false"
name="screen"
width="1024">
<layout_stack border_size="0"
follows="all"
height="768"
mouse_opaque="false"
name="menu_stack"
orientation="vertical">
<!-- filename="panel_status_bar.xml"-->
<layout_panel auto_resize="false"
mouse_opaque="false"
name="status_bar_container"
width="1024"
visible="false"/>
<!--filename="panel_navigation_bar.xml"-->
<layout_panel auto_resize="false"
height="65"
mouse_opaque="false"
name="nav_bar_container"
width="1024"
visible="false"/>
<layout_stack auto_resize="true"
border_size="0"
follows="all"
height="500"
mouse_opaque="false"
name="hud_stack"
orientation="horizontal"
width="1024">
<panel auto_resize="true"
follows="all"
height="500"
layout="topleft"
mouse_opaque="false"
name="main_view"
user_resize="true"
width="500">
<layout_stack bottom="500"
follows="all"
height="500"
mouse_opaque="false"
name="hud_stack"
orientation="vertical">
<panel auto_resize="true"
follows="all"
height="500"
layout="topleft"
mouse_opaque="false"
name="hud container"
width="500">
<debug_view follows="all"
left="0"
top="0"
mouse_opaque="false"
height="500"
name="DebugView"
width="500"/>
<panel follows="right|top|bottom"
height="500"
mouse_opaque="false"
name="side_bar_tabs"
right="500"
top="0"
width="32"/>
</panel>
<!--filename="panel_stand_stop_flying.xml"-->
<layout_panel auto_resize="false"
follows="all"
min_height="25"
mouse_opaque="false"
name="stand_stop_flying_container"
visible="false"/>
<!--filename="panel_bottomtray.xml"-->
<layout_panel auto_resize="false"
follows="all"
min_height="33"
mouse_opaque="false"
name="bottom_tray_container"
visible="false"/>
</layout_stack>
<floater_view follows="all"
height="500"
mouse_opaque="false"
name="Floater View"
tab_group="-1"
tab_stop="false"
top="0"/>
<snapshot_floater_view enabled="false"
follows="all"
height="500"
left="0"
mouse_opaque="false"
name="Snapshot Floater View"
tab_stop="false"
top="0"
visible="false"/>
</panel>
<!-- side tray -->
<layout_panel auto_resize="false"
follows="all"
height="500"
min_width="333"
mouse_opaque="false"
name="side_tray_container"
user_resize="true"
visible="false"
width="333"/>
</layout_stack>
</layout_stack>
<notify_box_view top="0"
follows="all"
height="768"
mouse_opaque="false"
name="notify_container"
tab_group="-2"
width="1024"/>
<menu_holder top="0"
follows="all"
height="768"
mouse_opaque="false"
name="Menu Holder"
width="1024"/>
<tooltip_view top="0"
follows="all"
height="768"
mouse_opaque="false"
name="tooltip view"
tab_group="-2"
width="1024"/>
</panel>