summaryrefslogtreecommitdiff
path: root/indra/newview/llviewerwindow.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview/llviewerwindow.cpp')
-rw-r--r--indra/newview/llviewerwindow.cpp273
1 files changed, 76 insertions, 197 deletions
diff --git a/indra/newview/llviewerwindow.cpp b/indra/newview/llviewerwindow.cpp
index 48439765e4..8ea8fbf905 100644
--- a/indra/newview/llviewerwindow.cpp
+++ b/indra/newview/llviewerwindow.cpp
@@ -741,18 +741,16 @@ public:
if (gSavedSettings.getBOOL("DebugShowAvatarRenderInfo"))
{
std::map<std::string, LLVOAvatar*> sorted_avs;
-
- std::vector<LLCharacter*>::iterator sort_iter = LLCharacter::sInstances.begin();
- while (sort_iter != LLCharacter::sInstances.end())
{
- LLVOAvatar* avatar = dynamic_cast<LLVOAvatar*>(*sort_iter);
- if (avatar &&
- !avatar->isDead()) // Not dead yet
+ for (LLCharacter* character : LLCharacter::sInstances)
{
- // Stuff into a sorted map so the display is ordered
- sorted_avs[avatar->getFullname()] = avatar;
+ LLVOAvatar* avatar = (LLVOAvatar*)character;
+ if (!avatar->isDead()) // Not dead yet
+ {
+ // Stuff into a sorted map so the display is ordered
+ sorted_avs[avatar->getFullname()] = avatar;
+ }
}
- sort_iter++;
}
std::string trunc_name;
@@ -805,8 +803,8 @@ public:
LLCoordGL coord = gViewerWindow->getCurrentMouse();
// Convert x,y to raw pixel coords
- S32 x_raw = llround(coord.mX * gViewerWindow->getWindowWidthRaw() / (F32) gViewerWindow->getWindowWidthScaled());
- S32 y_raw = llround(coord.mY * gViewerWindow->getWindowHeightRaw() / (F32) gViewerWindow->getWindowHeightScaled());
+ S32 x_raw = (S32)llround(coord.mX * gViewerWindow->getWindowWidthRaw() / (F32) gViewerWindow->getWindowWidthScaled());
+ S32 y_raw = (S32)llround(coord.mY * gViewerWindow->getWindowHeightRaw() / (F32) gViewerWindow->getWindowHeightScaled());
glReadPixels(x_raw, y_raw, 1, 1, GL_RGBA, GL_UNSIGNED_BYTE, color);
addText(xpos, ypos, llformat("Pixel <%1d, %1d> R:%1d G:%1d B:%1d A:%1d", x_raw, y_raw, color[0], color[1], color[2], color[3]));
@@ -1827,10 +1825,8 @@ LLViewerWindow::LLViewerWindow(const Params& p)
mToolStored( NULL ),
mHideCursorPermanent( false ),
mCursorHidden(false),
- mIgnoreActivate( false ),
mResDirty(false),
mStatesDirty(false),
- mCurrResolutionIndex(0),
mProgressView(NULL)
{
// gKeyboard is still NULL, so it doesn't do LLWindowListener any good to
@@ -2068,6 +2064,9 @@ void LLViewerWindow::initBase()
mPopupView = main_view->getChild<LLPopupView>("popup_holder");
mHintHolder = main_view->getChild<LLView>("hint_holder")->getHandle();
mLoginPanelHolder = main_view->getChild<LLView>("login_panel_holder")->getHandle();
+ mStatusBarContainer = main_view->getChild<LLPanel>("status_bar_container");
+ mNavBarContainer = mStatusBarContainer->getChild<LLView>("nav_bar_container");
+ mTopInfoContainer = main_view->getChild<LLPanel>("topinfo_bar_container");
// Create the toolbar view
// Get a pointer to the toolbar view holder
@@ -2083,6 +2082,8 @@ void LLViewerWindow::initBase()
// Hide the toolbars for the moment: we'll make them visible after logging in world (see LLViewerWindow::initWorldUI())
gToolBarView->setVisible(false);
+ mFloaterSnapRegion = gToolBarView->getChild<LLView>("floater_snap_region");
+ mChicletContainer = gToolBarView->getChild<LLPanel>("chiclet_container");
// Constrain floaters to inside the menu and status bar regions.
gFloaterView = main_view->getChild<LLFloaterView>("Floater View");
for (S32 i = 0; i < LLToolBarEnums::TOOLBAR_COUNT; ++i)
@@ -2093,7 +2094,7 @@ void LLViewerWindow::initBase()
toolbarp->getCenterLayoutPanel()->setReshapeCallback(boost::bind(&LLFloaterView::setToolbarRect, gFloaterView, _1, _2));
}
}
- gFloaterView->setFloaterSnapView(main_view->getChild<LLView>("floater_snap_region")->getHandle());
+ gFloaterView->setFloaterSnapView(mFloaterSnapRegion->getHandle());
gSnapshotFloaterView = main_view->getChild<LLSnapshotFloaterView>("Snapshot Floater View");
const F32 CHAT_PERSIST_TIME = 20.f;
@@ -2159,12 +2160,11 @@ void LLViewerWindow::initWorldUI()
if (!gNonInteractive)
{
- LLPanel* chiclet_container = getRootView()->getChild<LLPanel>("chiclet_container");
LLChicletBar* chiclet_bar = LLChicletBar::getInstance();
- chiclet_bar->setShape(chiclet_container->getLocalRect());
+ chiclet_bar->setShape(mChicletContainer->getLocalRect());
chiclet_bar->setFollowsAll();
- chiclet_container->addChild(chiclet_bar);
- chiclet_container->setVisible(true);
+ mChicletContainer->addChild(chiclet_bar);
+ mChicletContainer->setVisible(true);
}
LLRect morph_view_rect = full_window;
@@ -2189,30 +2189,25 @@ void LLViewerWindow::initWorldUI()
if (!gStatusBar)
{
// Status bar
- LLPanel* status_bar_container = getRootView()->getChild<LLPanel>("status_bar_container");
- gStatusBar = new LLStatusBar(status_bar_container->getLocalRect());
+ gStatusBar = new LLStatusBar(mStatusBarContainer->getLocalRect());
gStatusBar->setFollows(FOLLOWS_LEFT | FOLLOWS_TOP | FOLLOWS_RIGHT);
- gStatusBar->setShape(status_bar_container->getLocalRect());
+ gStatusBar->setShape(mStatusBarContainer->getLocalRect());
// sync bg color with menu bar
- gStatusBar->setBackgroundColor(gMenuBarView->getBackgroundColor().get());
+ gStatusBar->setBackgroundColor(gMenuBarView->getBackgroundColor());
// add InBack so that gStatusBar won't be drawn over menu
- status_bar_container->addChildInBack(gStatusBar, 2/*tab order, after menu*/);
- status_bar_container->setVisible(true);
+ mStatusBarContainer->addChildInBack(gStatusBar, 2/*tab order, after menu*/);
+ mStatusBarContainer->setVisible(true);
// Navigation bar
- LLView* nav_bar_container = getRootView()->getChild<LLView>("nav_bar_container");
-
- navbar->setShape(nav_bar_container->getLocalRect());
- navbar->setBackgroundColor(gMenuBarView->getBackgroundColor().get());
- nav_bar_container->addChild(navbar);
- nav_bar_container->setVisible(true);
+ navbar->setShape(mNavBarContainer->getLocalRect());
+ navbar->setBackgroundColor(gMenuBarView->getBackgroundColor());
+ mNavBarContainer->addChild(navbar);
+ mNavBarContainer->setVisible(true);
}
else
{
- LLPanel* status_bar_container = getRootView()->getChild<LLPanel>("status_bar_container");
- LLView* nav_bar_container = getRootView()->getChild<LLView>("nav_bar_container");
- status_bar_container->setVisible(true);
- nav_bar_container->setVisible(true);
+ mStatusBarContainer->setVisible(true);
+ mNavBarContainer->setVisible(true);
}
if (!gSavedSettings.getBOOL("ShowNavbarNavigationPanel"))
@@ -2226,13 +2221,11 @@ void LLViewerWindow::initWorldUI()
// Top Info bar
- LLPanel* topinfo_bar_container = getRootView()->getChild<LLPanel>("topinfo_bar_container");
LLPanelTopInfoBar* topinfo_bar = LLPanelTopInfoBar::getInstance();
+ topinfo_bar->setShape(mTopInfoContainer->getLocalRect());
- topinfo_bar->setShape(topinfo_bar_container->getLocalRect());
-
- topinfo_bar_container->addChild(topinfo_bar);
- topinfo_bar_container->setVisible(true);
+ mTopInfoContainer->addChild(topinfo_bar);
+ mTopInfoContainer->setVisible(true);
if (!gSavedSettings.getBOOL("ShowMiniLocationPanel"))
{
@@ -2252,7 +2245,7 @@ void LLViewerWindow::initWorldUI()
getRootView()->sendChildToBack(gHUDView);
}
- LLPanel* panel_ssf_container = getRootView()->getChild<LLPanel>("state_management_buttons_container");
+ LLPanel* panel_ssf_container = gToolBarView->getChild<LLPanel>("state_management_buttons_container");
LLPanelStandStopFlying* panel_stand_stop_flying = LLPanelStandStopFlying::getInstance();
panel_ssf_container->addChild(panel_stand_stop_flying);
@@ -2402,7 +2395,7 @@ void LLViewerWindow::shutdownGL()
LLSelectMgr::getInstance()->cleanup();
LL_INFOS() << "Stopping GL during shutdown" << LL_ENDL;
- stopGL(false);
+ stopGL();
stop_glerror();
gGL.shutdown();
@@ -2575,19 +2568,18 @@ void LLViewerWindow::setNormalControlsVisible( bool visible )
gStatusBar->setEnabled( visible );
}
- LLNavigationBar* navbarp = LLUI::getInstance()->getRootView()->findChild<LLNavigationBar>("navigation_bar");
- if (navbarp)
+ if (mNavBarContainer)
{
// 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") );
+ mNavBarContainer->setVisible( visible && gSavedSettings.getBOOL("ShowNavbarNavigationPanel") );
}
}
void LLViewerWindow::setMenuBackgroundColor(bool god_mode, bool dev_grid)
{
LLSD args;
- LLColor4 new_bg_color;
+ LLUIColor new_bg_color;
// god more important than project, proj more important than grid
if ( god_mode )
@@ -2677,7 +2669,7 @@ void LLViewerWindow::draw()
//S32 screen_x, screen_y;
- if (!gSavedSettings.getBOOL("RenderUIBuffer"))
+ if (!LLPipeline::RenderUIBuffer)
{
LLView::sDirtyRect = getWindowRectScaled();
}
@@ -4189,15 +4181,17 @@ void LLViewerWindow::renderSelections( bool for_gl_pick, bool pick_parcel_walls,
}
}
}
- if (selection->getSelectType() == SELECT_TYPE_HUD && selection->getObjectCount())
- {
- gGL.matrixMode(LLRender::MM_PROJECTION);
- gGL.popMatrix();
+ }
- gGL.matrixMode(LLRender::MM_MODELVIEW);
- gGL.popMatrix();
- stop_glerror();
- }
+ // un-setup HUD render
+ if (selection->getSelectType() == SELECT_TYPE_HUD && selection->getObjectCount())
+ {
+ gGL.matrixMode(LLRender::MM_PROJECTION);
+ gGL.popMatrix();
+
+ gGL.matrixMode(LLRender::MM_MODELVIEW);
+ gGL.popMatrix();
+ stop_glerror();
}
}
}
@@ -4481,8 +4475,8 @@ LLVector3 LLViewerWindow::mouseDirectionGlobal(const S32 x, const S32 y) const
F32 fov = LLViewerCamera::getInstance()->getView();
// find world view center in scaled ui coordinates
- F32 center_x = getWorldViewRectScaled().getCenterX();
- F32 center_y = getWorldViewRectScaled().getCenterY();
+ F32 center_x = (F32)getWorldViewRectScaled().getCenterX();
+ F32 center_y = (F32)getWorldViewRectScaled().getCenterY();
// calculate pixel distance to screen
F32 distance = ((F32)getWorldViewHeightScaled() * 0.5f) / (tan(fov / 2.f));
@@ -4507,8 +4501,8 @@ LLVector3 LLViewerWindow::mousePointHUD(const S32 x, const S32 y) const
S32 height = getWorldViewHeightScaled();
// find world view center
- F32 center_x = getWorldViewRectScaled().getCenterX();
- F32 center_y = getWorldViewRectScaled().getCenterY();
+ F32 center_x = (F32)getWorldViewRectScaled().getCenterX();
+ F32 center_y = (F32)getWorldViewRectScaled().getCenterY();
// remap with uniform scale (1/height) so that top is -0.5, bottom is +0.5
F32 hud_x = -((F32)x - center_x) / height;
@@ -4530,8 +4524,8 @@ LLVector3 LLViewerWindow::mouseDirectionCamera(const S32 x, const S32 y) const
S32 width = getWorldViewWidthScaled();
// find world view center
- F32 center_x = getWorldViewRectScaled().getCenterX();
- F32 center_y = getWorldViewRectScaled().getCenterY();
+ F32 center_x = (F32)getWorldViewRectScaled().getCenterX();
+ F32 center_y = (F32)getWorldViewRectScaled().getCenterY();
// calculate click point relative to middle of screen
F32 click_x = (((F32)x - center_x) / (F32)width) * fov_width * -1.f;
@@ -4779,7 +4773,7 @@ void LLViewerWindow::saveImageLocal(LLImageFormatted *image, const snapshot_save
args["NEED_MEMORY"] = needM_bytes_string;
std::string freeM_bytes_string;
- LLResMgr::getInstance()->getIntegerString(freeM_bytes_string, (b_space.free) >> 10);
+ LLResMgr::getInstance()->getIntegerString(freeM_bytes_string, (S32)(b_space.free >> 10));
args["FREE_MEMORY"] = freeM_bytes_string;
LLNotificationsUtil::add("SnapshotToComputerFailed", args);
@@ -5625,7 +5619,7 @@ void LLViewerWindow::setup3DRender()
void LLViewerWindow::setup3DViewport(S32 x_offset, S32 y_offset)
{
- LL_PROFILE_ZONE_SCOPED_CATEGORY_UI
+ LL_PROFILE_ZONE_SCOPED_CATEGORY_UI;
gGLViewport[0] = mWorldViewRectRaw.mLeft + x_offset;
gGLViewport[1] = mWorldViewRectRaw.mBottom + y_offset;
gGLViewport[2] = mWorldViewRectRaw.getWidth();
@@ -5715,7 +5709,7 @@ void LLViewerWindow::dumpState()
<< LL_ENDL;
}
-void LLViewerWindow::stopGL(bool save_state)
+void LLViewerWindow::stopGL()
{
//Note: --bao
//if not necessary, do not change the order of the function calls in this function.
@@ -5761,7 +5755,7 @@ void LLViewerWindow::stopGL(bool save_state)
gPostProcess->invalidate();
}
- gTextureList.destroyGL(save_state);
+ gTextureList.destroyGL();
stop_glerror();
gGLManager.mIsDisabled = true;
@@ -5778,6 +5772,14 @@ void LLViewerWindow::stopGL(bool save_state)
void LLViewerWindow::restoreGL(const std::string& progress_message)
{
+ llassert(false);
+ // DEPRECATED -- this is left over from when we would completely destroy and restore a GL context
+ // when switching from windowed to fullscreen. None of this machinery has been exercised in years
+ // and is unreliable. If we ever *do* have another use case where completely unloading and reloading
+ // everthing is necessary, requiring a viewer restart for that operation is a fine thing to do.
+ // -- davep
+
+
//Note: --bao
//if not necessary, do not change the order of the function calls in this function.
//if change something, make sure it will not break anything.
@@ -5790,8 +5792,6 @@ void LLViewerWindow::restoreGL(const std::string& progress_message)
initGLDefaults();
LLGLState::restoreGL();
- gTextureList.restoreGL();
-
// for future support of non-square pixels, and fonts that are properly stretched
//LLFontGL::destroyDefaultFonts();
initFonts();
@@ -5867,122 +5867,6 @@ void LLViewerWindow::checkSettings()
}
}
-void LLViewerWindow::restartDisplay(bool show_progress_bar)
-{
- LL_INFOS() << "Restaring GL" << LL_ENDL;
- stopGL();
- if (show_progress_bar)
- {
- restoreGL(LLTrans::getString("ProgressChangingResolution"));
- }
- else
- {
- restoreGL();
- }
-}
-
-bool LLViewerWindow::changeDisplaySettings(LLCoordScreen size, bool enable_vsync, bool show_progress_bar)
-{
- //bool was_maximized = gSavedSettings.getBOOL("WindowMaximized");
-
- //gResizeScreenTexture = true;
-
-
- //U32 fsaa = gSavedSettings.getU32("RenderFSAASamples");
- //U32 old_fsaa = mWindow->getFSAASamples();
-
- // if not maximized, use the request size
- if (!mWindow->getMaximized())
- {
- mWindow->setSize(size);
- }
-
- //if (fsaa == old_fsaa)
- {
- return true;
- }
-
-/*
-
- // Close floaters that don't handle settings change
- LLFloaterReg::hideInstance("snapshot");
-
- bool result_first_try = false;
- bool result_second_try = false;
-
- LLFocusableElement* keyboard_focus = gFocusMgr.getKeyboardFocus();
- send_agent_pause();
- LL_INFOS() << "Stopping GL during changeDisplaySettings" << LL_ENDL;
- stopGL();
- mIgnoreActivate = true;
- LLCoordScreen old_size;
- LLCoordScreen old_pos;
- mWindow->getSize(&old_size);
-
- //mWindow->setFSAASamples(fsaa);
-
- result_first_try = mWindow->switchContext(false, size, disable_vsync);
- if (!result_first_try)
- {
- // try to switch back
- //mWindow->setFSAASamples(old_fsaa);
- result_second_try = mWindow->switchContext(false, old_size, disable_vsync);
-
- if (!result_second_try)
- {
- // we are stuck...try once again with a minimal resolution?
- send_agent_resume();
- mIgnoreActivate = false;
- return false;
- }
- }
- send_agent_resume();
-
- LL_INFOS() << "Restoring GL during resolution change" << LL_ENDL;
- if (show_progress_bar)
- {
- restoreGL(LLTrans::getString("ProgressChangingResolution"));
- }
- else
- {
- restoreGL();
- }
-
- if (!result_first_try)
- {
- LLSD args;
- args["RESX"] = llformat("%d",size.mX);
- args["RESY"] = llformat("%d",size.mY);
- LLNotificationsUtil::add("ResolutionSwitchFail", args);
- size = old_size; // for reshape below
- }
-
- bool success = result_first_try || result_second_try;
-
- if (success)
- {
- // maximize window if was maximized, else reposition
- if (was_maximized)
- {
- mWindow->maximize();
- }
- else
- {
- S32 windowX = gSavedSettings.getS32("WindowX");
- S32 windowY = gSavedSettings.getS32("WindowY");
-
- mWindow->setPosition(LLCoordScreen ( windowX, windowY ) );
- }
- }
-
- mIgnoreActivate = false;
- gFocusMgr.setKeyboardFocus(keyboard_focus);
-
- return success;
-
- */
-}
-
F32 LLViewerWindow::getWorldViewAspectRatio() const
{
F32 world_aspect = (F32)mWorldViewRectRaw.getWidth() / (F32)mWorldViewRectRaw.getHeight();
@@ -6066,23 +5950,20 @@ LLRect LLViewerWindow::getChatConsoleRect()
void LLViewerWindow::reshapeStatusBarContainer()
{
- LLPanel* status_bar_container = getRootView()->getChild<LLPanel>("status_bar_container");
- LLView* nav_bar_container = getRootView()->getChild<LLView>("nav_bar_container");
-
- S32 new_height = status_bar_container->getRect().getHeight();
- S32 new_width = status_bar_container->getRect().getWidth();
+ S32 new_height = mStatusBarContainer->getRect().getHeight();
+ S32 new_width = mStatusBarContainer->getRect().getWidth();
if (gSavedSettings.getBOOL("ShowNavbarNavigationPanel"))
{
// Navigation bar is outside visible area, expand status_bar_container to show it
- new_height += nav_bar_container->getRect().getHeight();
+ new_height += mNavBarContainer->getRect().getHeight();
}
else
{
// collapse status_bar_container
- new_height -= nav_bar_container->getRect().getHeight();
+ new_height -= mNavBarContainer->getRect().getHeight();
}
- status_bar_container->reshape(new_width, new_height, true);
+ mStatusBarContainer->reshape(new_width, new_height, true);
}
void LLViewerWindow::resetStatusBarContainer()
@@ -6091,12 +5972,10 @@ void LLViewerWindow::resetStatusBarContainer()
if (gSavedSettings.getBOOL("ShowNavbarNavigationPanel") || navbar->getVisible())
{
// was previously showing navigation bar
- LLView* nav_bar_container = getRootView()->getChild<LLView>("nav_bar_container");
- LLPanel* status_bar_container = getRootView()->getChild<LLPanel>("status_bar_container");
- S32 new_height = status_bar_container->getRect().getHeight();
- S32 new_width = status_bar_container->getRect().getWidth();
- new_height -= nav_bar_container->getRect().getHeight();
- status_bar_container->reshape(new_width, new_height, true);
+ S32 new_height = mStatusBarContainer->getRect().getHeight();
+ S32 new_width = mStatusBarContainer->getRect().getWidth();
+ new_height -= mNavBarContainer->getRect().getHeight();
+ mStatusBarContainer->reshape(new_width, new_height, true);
}
}
//----------------------------------------------------------------------------
@@ -6123,7 +6002,7 @@ void LLViewerWindow::setUIVisibility(bool visible)
LLNavigationBar::getInstance()->setVisible(visible ? gSavedSettings.getBOOL("ShowNavbarNavigationPanel") : false);
LLPanelTopInfoBar::getInstance()->setVisible(visible? gSavedSettings.getBOOL("ShowMiniLocationPanel") : false);
- mRootView->getChildView("status_bar_container")->setVisible(visible);
+ mStatusBarContainer->setVisible(visible);
}
bool LLViewerWindow::getUIVisibility()