summaryrefslogtreecommitdiff
path: root/indra/newview/llviewerwindow.cpp
diff options
context:
space:
mode:
authorRichard Linden <none@none>2011-10-27 17:22:26 -0700
committerRichard Linden <none@none>2011-10-27 17:22:26 -0700
commit6e8ffc247fe52668446b8fa1ed7f1547a755076f (patch)
tree23b6fa5ce6bf6a32944faca54f9a18aca255fd75 /indra/newview/llviewerwindow.cpp
parent0ecc5c0878adf93e96b99e3db4c65cdb757b99fb (diff)
parentfcd1ccd21e3ea8f0944537347dd6c9d7972d50ce (diff)
Automated merge with ssh://hg.lindenlab.com/richard/viewer-experience
Diffstat (limited to 'indra/newview/llviewerwindow.cpp')
-rw-r--r--indra/newview/llviewerwindow.cpp183
1 files changed, 109 insertions, 74 deletions
diff --git a/indra/newview/llviewerwindow.cpp b/indra/newview/llviewerwindow.cpp
index a7f4209e69..6fcbc401af 100644
--- a/indra/newview/llviewerwindow.cpp
+++ b/indra/newview/llviewerwindow.cpp
@@ -36,6 +36,7 @@
#include <iostream>
#include <fstream>
#include <algorithm>
+#include <boost/lambda/core.hpp>
#include "llagent.h"
#include "llagentcamera.h"
@@ -84,6 +85,7 @@
// newview includes
#include "llagent.h"
#include "llbox.h"
+#include "llchicletbar.h"
#include "llconsole.h"
#include "llviewercontrol.h"
#include "llcylinder.h"
@@ -132,7 +134,6 @@
#include "llpreviewtexture.h"
#include "llprogressview.h"
#include "llresmgr.h"
-#include "llsidetray.h"
#include "llselectmgr.h"
#include "llrootview.h"
#include "llrendersphere.h"
@@ -147,6 +148,7 @@
#include "lltexturefetch.h"
#include "lltextureview.h"
#include "lltool.h"
+#include "lltoolbarview.h"
#include "lltoolcomp.h"
#include "lltooldraganddrop.h"
#include "lltoolface.h"
@@ -186,7 +188,6 @@
#include "llviewerjoystick.h"
#include "llviewernetwork.h"
#include "llpostprocess.h"
-#include "llbottomtray.h"
#include "llnearbychatbar.h"
#include "llagentui.h"
#include "llwearablelist.h"
@@ -198,6 +199,7 @@
#include "llfloaternotificationsconsole.h"
#include "llnearbychat.h"
+#include "llwindowlistener.h"
#include "llviewerwindowlistener.h"
#include "llpaneltopinfobar.h"
@@ -938,6 +940,11 @@ BOOL LLViewerWindow::handleAnyMouseClick(LLWindow *window, LLCoordGL pos, MASK
// }
//}
+ // Mark the click as handled and return if we aren't within the root view to avoid spurious bugs
+ if( !mRootView->pointInView(x, y) )
+ {
+ return TRUE;
+ }
// Give the UI views a chance to process the click
if( mRootView->handleAnyMouseClick(x, y, mask, clicktype, down) )
{
@@ -1339,7 +1346,7 @@ BOOL LLViewerWindow::handleActivate(LLWindow *window, BOOL activated)
{
if (activated)
{
- mActive = TRUE;
+ mActive = true;
send_agent_resume();
gAgent.clearAFK();
@@ -1348,7 +1355,7 @@ BOOL LLViewerWindow::handleActivate(LLWindow *window, BOOL activated)
}
else
{
- mActive = FALSE;
+ mActive = false;
// if the user has chosen to go Away automatically after some time, then go Away when minimizing
if (gSavedSettings.getS32("AFKTimeout"))
@@ -1531,7 +1538,8 @@ LLViewerWindow::LLViewerWindow(
BOOL fullscreen, BOOL ignore_pixel_depth) // fullscreen is no longer used
:
mWindow(NULL),
- mActive(TRUE),
+ mActive(true),
+ mUIVisible(true),
mWindowRectRaw(0, height, width, 0),
mWindowRectScaled(0, height, width, 0),
mWorldViewRectRaw(0, height, width, 0),
@@ -1547,7 +1555,12 @@ LLViewerWindow::LLViewerWindow(
mResDirty(false),
mStatesDirty(false),
mCurrResolutionIndex(0),
- mViewerWindowListener(new LLViewerWindowListener(this)),
+ // gKeyboard is still NULL, so it doesn't do LLWindowListener any good to
+ // pass its value right now. Instead, pass it a nullary function that
+ // will, when we later need it, return the value of gKeyboard.
+ // boost::lambda::var() constructs such a functor on the fly.
+ mWindowListener(new LLWindowListener(this, boost::lambda::var(gKeyboard))),
+ mViewerWindowListener(new LLViewerWindowListener(this)),
mProgressView(NULL)
{
LLNotificationChannel::buildChannel("VW_alerts", "Visible", LLNotificationFilters::filterBy<std::string>(&LLNotification::getType, "alert"));
@@ -1644,7 +1657,7 @@ LLViewerWindow::LLViewerWindow(
if (LLFeatureManager::getInstance()->isSafe()
|| (gSavedSettings.getS32("LastFeatureVersion") != LLFeatureManager::getInstance()->getVersion())
- || (gSavedSettings.getS32("LastGPUClass") != LLFeatureManager::getInstance()->getGPUClass())
+ || (gSavedSettings.getString("LastGPUString") != LLFeatureManager::getInstance()->getGPUString())
|| (gSavedSettings.getBOOL("ProbeHardwareOnStartup")))
{
LLFeatureManager::getInstance()->applyRecommendedSettings();
@@ -1771,12 +1784,23 @@ void LLViewerWindow::initBase()
// placeholder widget that controls where "world" is rendered
mWorldViewPlaceholder = main_view->getChildView("world_view_rect")->getHandle();
- mNonSideTrayView = main_view->getChildView("non_side_tray_view")->getHandle();
- mFloaterViewHolder = main_view->getChildView("floater_view_holder")->getHandle();
mPopupView = main_view->getChild<LLPopupView>("popup_holder");
mHintHolder = main_view->getChild<LLView>("hint_holder")->getHandle();
mLoginPanelHolder = main_view->getChild<LLView>("login_panel_holder")->getHandle();
+ // Create the toolbar view
+ // *TODO: Eventually, suppress the existence of this debug setting and turn toolbar FUI on permanently
+ if (gSavedSettings.getBOOL("DebugToolbarFUI"))
+ {
+ // Get a pointer to the toolbar view holder
+ LLPanel* panel_holder = main_view->getChild<LLPanel>("toolbar_view_holder");
+ // Load the toolbar view from file
+ gToolBarView = LLUICtrlFactory::getInstance()->createFromFile<LLToolBarView>("panel_toolbar_view.xml", panel_holder, LLDefaultChildRegistry::instance());
+ gToolBarView->setShape(panel_holder->getLocalRect());
+ // Hide the toolbars for the moment: we'll make them visible after logging in world (see LLViewerWindow::initWorldUI())
+ gToolBarView->setVisible(FALSE);
+ }
+
// Constrain floaters to inside the menu and status bar regions.
gFloaterView = main_view->getChild<LLFloaterView>("Floater View");
gFloaterView->setFloaterSnapView(main_view->getChild<LLView>("floater_snap_region")->getHandle());
@@ -1836,13 +1860,12 @@ void LLViewerWindow::initWorldUI()
//getRootView()->sendChildToFront(gFloaterView);
//getRootView()->sendChildToFront(gSnapshotFloaterView);
- // new bottom panel
- LLPanel* bottom_tray_container = getRootView()->getChild<LLPanel>("bottom_tray_container");
- LLBottomTray* bottom_tray = LLBottomTray::getInstance();
- bottom_tray->setShape(bottom_tray_container->getLocalRect());
- bottom_tray->setFollowsAll();
- bottom_tray_container->addChild(bottom_tray);
- bottom_tray_container->setVisible(TRUE);
+ LLPanel* chiclet_container = getRootView()->getChild<LLPanel>("chiclet_container");
+ LLChicletBar* chiclet_bar = LLChicletBar::getInstance();
+ chiclet_bar->setShape(chiclet_container->getLocalRect());
+ chiclet_bar->setFollowsAll();
+ chiclet_container->addChild(chiclet_bar);
+ chiclet_container->setVisible(TRUE);
LLRect morph_view_rect = full_window;
morph_view_rect.stretch( -STATUS_BAR_HEIGHT );
@@ -1870,7 +1893,7 @@ void LLViewerWindow::initWorldUI()
gStatusBar->setShape(status_bar_container->getLocalRect());
// sync bg color with menu bar
gStatusBar->setBackgroundColor( gMenuBarView->getBackgroundColor().get() );
- status_bar_container->addChild(gStatusBar);
+ status_bar_container->addChildInBack(gStatusBar);
status_bar_container->setVisible(TRUE);
// Navigation bar
@@ -1884,12 +1907,7 @@ void LLViewerWindow::initWorldUI()
if (!gSavedSettings.getBOOL("ShowNavbarNavigationPanel"))
{
- navbar->showNavigationPanel(FALSE);
- }
-
- if (!gSavedSettings.getBOOL("ShowNavbarFavoritesPanel"))
- {
- navbar->showFavoritesPanel(FALSE);
+ navbar->setVisible(FALSE);
}
// Top Info bar
@@ -1915,8 +1933,7 @@ void LLViewerWindow::initWorldUI()
hud_rect.mTop -= gMenuBarView->getRect().getHeight();
}
gHUDView = new LLHUDView(hud_rect);
- // put behind everything else in the UI
- getRootView()->addChildInBack(gHUDView);
+ getRootView()->addChild(gHUDView);
}
LLPanel* panel_ssf_container = getRootView()->getChild<LLPanel>("stand_stop_flying_container");
@@ -1924,40 +1941,30 @@ void LLViewerWindow::initWorldUI()
panel_ssf_container->addChild(panel_stand_stop_flying);
panel_ssf_container->setVisible(TRUE);
- // put sidetray in container
- LLPanel* side_tray_container = getRootView()->getChild<LLPanel>("side_tray_container");
- LLSideTray* sidetrayp = LLSideTray::getInstance();
- sidetrayp->setShape(side_tray_container->getLocalRect());
- // don't follow right edge to avoid spurious resizes, since we are using a fixed width layout
- sidetrayp->setFollows(FOLLOWS_LEFT|FOLLOWS_TOP|FOLLOWS_BOTTOM);
- 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<LLPanel>("side_bar_tabs");
- buttons_panel->setShape(buttons_panel_container->getLocalRect());
- buttons_panel->setFollowsAll();
- buttons_panel_container->addChild(buttons_panel);
-
- LLView* avatar_picker_destination_guide_container = gViewerWindow->getRootView()->getChild<LLView>("avatar_picker_and_destination_guide_container");
- avatar_picker_destination_guide_container->getChild<LLButton>("close")->setCommitCallback(boost::bind(toggle_destination_and_avatar_picker, LLSD()));
- LLMediaCtrl* destinations = avatar_picker_destination_guide_container->findChild<LLMediaCtrl>("destination_guide_contents");
- LLMediaCtrl* avatar_picker = avatar_picker_destination_guide_container->findChild<LLMediaCtrl>("avatar_picker_contents");
+ // Load and make the toolbars visible
+ // Note: we need to load the toolbars only *after* the user is logged in and IW
+ if (gToolBarView)
+ {
+ gToolBarView->loadToolbars();
+ gToolBarView->setVisible(TRUE);
+ }
+
+ LLMediaCtrl* destinations = LLFloaterReg::getInstance("destinations")->getChild<LLMediaCtrl>("destination_guide_contents");
if (destinations)
{
destinations->setErrorPageURL(gSavedSettings.getString("GenericErrorPageURL"));
- destinations->navigateTo(gSavedSettings.getString("DestinationGuideURL"), "text/html");
+ std::string url = gSavedSettings.getString("DestinationGuideURL");
+ url = LLWeb::expandURLSubstitutions(url, LLSD());
+ destinations->navigateTo(url, "text/html");
}
-
+ LLMediaCtrl* avatar_picker = LLFloaterReg::getInstance("avatar")->findChild<LLMediaCtrl>("avatar_picker_contents");
if (avatar_picker)
{
avatar_picker->setErrorPageURL(gSavedSettings.getString("GenericErrorPageURL"));
- avatar_picker->navigateTo(gSavedSettings.getString("AvatarPickerURL"), "text/html");
+ std::string url = gSavedSettings.getString("AvatarPickerURL");
+ url = LLWeb::expandURLSubstitutions(url, LLSD());
+ avatar_picker->navigateTo(url, "text/html");
}
-
- // show destinations by default
- toggle_destination_and_avatar_picker(gSavedSettings.getS32("DestinationsAndAvatarsVisibility"));
}
// Destroy the UI
@@ -1983,7 +1990,7 @@ void LLViewerWindow::shutdownViews()
// *TODO: Make LLNavigationBar part of gViewerWindow
if (LLNavigationBar::instanceExists())
{
- delete LLNavigationBar::getInstance();
+ delete LLNavigationBar::getInstance();
}
// destroy menus after instantiating navbar above, as it needs
@@ -1999,6 +2006,7 @@ void LLViewerWindow::shutdownViews()
gIMMgr = NULL;
gToolTipView = NULL;
+ gToolBarView = NULL;
gFloaterView = NULL;
gMorphView = NULL;
@@ -2170,10 +2178,10 @@ void LLViewerWindow::reshape(S32 width, S32 height)
// Hide normal UI when a logon fails
void LLViewerWindow::setNormalControlsVisible( BOOL visible )
{
- if(LLBottomTray::instanceExists())
+ if(LLChicletBar::instanceExists())
{
- LLBottomTray::getInstance()->setVisible(visible);
- LLBottomTray::getInstance()->setEnabled(visible);
+ LLChicletBar::getInstance()->setVisible(visible);
+ LLChicletBar::getInstance()->setEnabled(visible);
}
if ( gMenuBarView )
@@ -2195,7 +2203,9 @@ void LLViewerWindow::setNormalControlsVisible( BOOL visible )
LLNavigationBar* navbarp = LLUI::getRootView()->findChild<LLNavigationBar>("navigation_bar");
if (navbarp)
{
- navbarp->setVisible( visible );
+ // when it's time to show navigation bar we need to ensure that the user wants to see it
+ // i.e. ShowNavbarNavigationPanel option is true
+ navbarp->setVisible( visible && gSavedSettings.getBOOL("ShowNavbarNavigationPanel") );
}
}
@@ -2466,7 +2476,12 @@ BOOL LLViewerWindow::handleKey(KEY key, MASK mask)
// Traverses up the hierarchy
if( keyboard_focus )
{
- LLLineEditor* chat_editor = LLBottomTray::instanceExists() ? LLBottomTray::getInstance()->getNearbyChatBar()->getChatBox() : NULL;
+ LLNearbyChatBar* nearby_chat = LLFloaterReg::findTypedInstance<LLNearbyChatBar>("chat_bar");
+
+ if (nearby_chat)
+ {
+ LLLineEditor* chat_editor = nearby_chat->getChatBox();
+
// arrow keys move avatar while chatting hack
if (chat_editor && chat_editor->hasFocus())
{
@@ -2497,7 +2512,7 @@ BOOL LLViewerWindow::handleKey(KEY key, MASK mask)
}
}
}
-
+ }
if (keyboard_focus->handleKey(key, mask, FALSE))
{
return TRUE;
@@ -2528,11 +2543,11 @@ BOOL LLViewerWindow::handleKey(KEY key, MASK mask)
if ( gSavedSettings.getS32("LetterKeysFocusChatBar") && !gAgentCamera.cameraMouselook() &&
!keyboard_focus && key < 0x80 && (mask == MASK_NONE || mask == MASK_SHIFT) )
{
- LLLineEditor* chat_editor = LLBottomTray::instanceExists() ? LLBottomTray::getInstance()->getNearbyChatBar()->getChatBox() : NULL;
+ LLLineEditor* chat_editor = LLFloaterReg::getTypedInstance<LLNearbyChatBar>("chat_bar")->getChatBox();
if (chat_editor)
{
// passing NULL here, character will be added later when it is handled by character handler.
- LLBottomTray::getInstance()->getNearbyChatBar()->startChat(NULL);
+ LLNearbyChatBar::getInstance()->startChat(NULL);
return TRUE;
}
}
@@ -3159,7 +3174,7 @@ void LLViewerWindow::updateLayout()
//gMenuBarView->setItemVisible("BuildTools", gFloaterTools->getVisible());
}
- LLFloaterBuildOptions* build_options_floater = LLFloaterReg::getTypedInstance<LLFloaterBuildOptions>("build_options");
+ LLFloaterBuildOptions* build_options_floater = LLFloaterReg::findTypedInstance<LLFloaterBuildOptions>("build_options");
if (build_options_floater && build_options_floater->getVisible())
{
build_options_floater->updateGridMode();
@@ -3303,9 +3318,6 @@ void LLViewerWindow::updateKeyboardFocus()
// make sure floater visible order is in sync with tab order
gFloaterView->syncFloaterTabOrder();
}
-
- if(LLSideTray::instanceCreated())//just getInstance will create sidetray. we don't want this
- LLSideTray::getInstance()->highlightFocused();
}
static LLFastTimer::DeclareTimer FTM_UPDATE_WORLD_VIEW("Update World View");
@@ -3329,12 +3341,6 @@ void LLViewerWindow::updateWorldViewRect(bool use_full_window)
new_world_rect.mTop = llround((F32)new_world_rect.mTop * mDisplayScale.mV[VY]);
}
- if (gSavedSettings.getBOOL("SidebarCameraMovement") == FALSE)
- {
- // use right edge of window, ignoring sidebar
- new_world_rect.mRight = mWindowRectRaw.mRight;
- }
-
if (mWorldViewRectRaw != new_world_rect)
{
mWorldViewRectRaw = new_world_rect;
@@ -4092,7 +4098,7 @@ static S32 BORDERWIDTH = 0;
void LLViewerWindow::movieSize(S32 new_width, S32 new_height)
{
LLCoordScreen size;
- gViewerWindow->mWindow->getSize(&size);
+ gViewerWindow->getWindow()->getSize(&size);
if ( (size.mX != new_width + BORDERWIDTH)
||(size.mY != new_height + BORDERHEIGHT))
{
@@ -4103,7 +4109,7 @@ void LLViewerWindow::movieSize(S32 new_width, S32 new_height)
BORDERHEIGHT = size.mY- y;
LLCoordScreen new_size(new_width + BORDERWIDTH,
new_height + BORDERHEIGHT);
- gViewerWindow->mWindow->setSize(new_size);
+ gViewerWindow->getWindow()->setSize(new_size);
}
}
@@ -4930,8 +4936,8 @@ S32 LLViewerWindow::getChatConsoleBottomPad()
{
S32 offset = 0;
- if(LLBottomTray::instanceExists())
- offset += LLBottomTray::getInstance()->getRect().getHeight();
+ if(gToolBarView)
+ offset += gToolBarView->getChild<LLView>("bottom_toolbar_panel")->getRect().getHeight();
return offset;
}
@@ -4987,6 +4993,35 @@ bool LLViewerWindow::onAlert(const LLSD& notify)
return false;
}
+void LLViewerWindow::setUIVisibility(bool visible)
+{
+ mUIVisible = visible;
+
+ if (!visible)
+ {
+ gAgentCamera.changeCameraToThirdPerson(FALSE);
+ gFloaterView->hideAllFloaters();
+ }
+ else
+ {
+ gFloaterView->showHiddenFloaters();
+ }
+
+ if (gToolBarView)
+ {
+ gToolBarView->setToolBarsVisible(visible);
+ }
+
+ mRootView->getChildView("topinfo_bar_container")->setVisible(visible);
+ mRootView->getChildView("nav_bar_container")->setVisible(visible);
+ mRootView->getChildView("status_bar_container")->setVisible(visible);
+}
+
+bool LLViewerWindow::getUIVisibility()
+{
+ return mUIVisible;
+}
+
////////////////////////////////////////////////////////////////////////////
//
// LLPickInfo