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.cpp2750
1 files changed, 1221 insertions, 1529 deletions
diff --git a/indra/newview/llviewerwindow.cpp b/indra/newview/llviewerwindow.cpp
index cb2a8771fa..983a2d25c8 100644
--- a/indra/newview/llviewerwindow.cpp
+++ b/indra/newview/llviewerwindow.cpp
@@ -2,49 +2,52 @@
* @file llviewerwindow.cpp
* @brief Implementation of the LLViewerWindow class.
*
- * $LicenseInfo:firstyear=2001&license=viewergpl$
- *
- * Copyright (c) 2001-2009, Linden Research, Inc.
- *
+ * $LicenseInfo:firstyear=2001&license=viewerlgpl$
* Second Life Viewer Source Code
- * The source code in this file ("Source Code") is provided by Linden Lab
- * to you under the terms of the GNU General Public License, version 2.0
- * ("GPL"), unless you have obtained a separate licensing agreement
- * ("Other License"), formally executed by you and Linden Lab. Terms of
- * the GPL can be found in doc/GPL-license.txt in this distribution, or
- * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
+ * Copyright (C) 2010, Linden Research, Inc.
*
- * There are special exceptions to the terms and conditions of the GPL as
- * it is applied to this Source Code. View the full text of the exception
- * in the file doc/FLOSS-exception.txt in this software distribution, or
- * online at
- * http://secondlifegrid.net/programs/open_source/licensing/flossexception
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation;
+ * version 2.1 of the License only.
*
- * By copying, modifying or distributing this software, you acknowledge
- * that you have read and understood your obligations described above,
- * and agree to abide by those obligations.
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
*
- * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
- * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
- * COMPLETENESS OR PERFORMANCE.
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
#include "llviewerprecompiledheaders.h"
+#include "llviewerwindow.h"
+
+#if LL_WINDOWS
+#pragma warning (disable : 4355) // 'this' used in initializer list: yes, intentionally
+#endif
+
// system library includes
#include <stdio.h>
#include <iostream>
#include <fstream>
#include <algorithm>
+#include "llagent.h"
+#include "llagentcamera.h"
#include "llfloaterreg.h"
#include "llpanellogin.h"
#include "llviewerkeyboard.h"
-#include "llviewerwindow.h"
+#include "llviewermenu.h"
#include "llviewquery.h"
#include "llxmltree.h"
+#include "llslurl.h"
//#include "llviewercamera.h"
#include "llrender.h"
@@ -55,7 +58,7 @@
//
// linden library includes
-#include "audioengine.h" // mute on minimize
+#include "llaudioengine.h" // mute on minimize
#include "indra_constants.h"
#include "llassetstorage.h"
#include "llerrorcontrol.h"
@@ -73,12 +76,13 @@
#include "lltimer.h"
#include "timing.h"
#include "llviewermenu.h"
+#include "lltooltip.h"
+#include "llmediaentry.h"
+#include "llurldispatcher.h"
// newview includes
#include "llagent.h"
-#include "llalertdialog.h"
#include "llbox.h"
-#include "llchatbar.h"
#include "llconsole.h"
#include "llviewercontrol.h"
#include "llcylinder.h"
@@ -92,14 +96,11 @@
#include "llface.h"
#include "llfeaturemanager.h"
#include "llfilepicker.h"
+#include "llfirstuse.h"
#include "llfloater.h"
-#include "llfloateractivespeakers.h"
#include "llfloaterbuildoptions.h"
#include "llfloaterbuyland.h"
#include "llfloatercamera.h"
-#include "llfloaterchat.h"
-#include "llfloaterchatterbox.h"
-#include "llfloatercustomize.h"
#include "llfloaterland.h"
#include "llfloaterinspect.h"
#include "llfloatermap.h"
@@ -109,14 +110,15 @@
#include "llfloatertools.h"
#include "llfloaterworldmap.h"
#include "llfocusmgr.h"
+#include "llfontfreetype.h"
#include "llgesturemgr.h"
#include "llglheaders.h"
-#include "llhoverview.h"
+#include "lltooltip.h"
#include "llhudmanager.h"
#include "llhudview.h"
#include "llimagebmp.h"
#include "llimagej2c.h"
-#include "llinventoryview.h"
+#include "llimageworker.h"
#include "llkeyboard.h"
#include "lllineeditor.h"
#include "llmenugl.h"
@@ -124,8 +126,7 @@
#include "llmorphview.h"
#include "llmoveview.h"
#include "llnavigationbar.h"
-#include "llnotify.h"
-#include "lloverlaybar.h"
+#include "llpopupview.h"
#include "llpreviewtexture.h"
#include "llprogressview.h"
#include "llresmgr.h"
@@ -138,14 +139,12 @@
#include "llstatview.h"
#include "llsurface.h"
#include "llsurfacepatch.h"
-#include "llimview.h"
#include "lltexlayer.h"
#include "lltextbox.h"
#include "lltexturecache.h"
#include "lltexturefetch.h"
#include "lltextureview.h"
#include "lltool.h"
-#include "lltoolbar.h"
#include "lltoolcomp.h"
#include "lltooldraganddrop.h"
#include "lltoolface.h"
@@ -157,14 +156,16 @@
#include "lltoolselectland.h"
#include "lltrans.h"
#include "lluictrlfactory.h"
-#include "lluploaddialog.h"
#include "llurldispatcher.h" // SLURL from other app instance
+#include "llversioninfo.h"
#include "llvieweraudio.h"
#include "llviewercamera.h"
#include "llviewergesture.h"
-#include "llviewerimagelist.h"
+#include "llviewertexturelist.h"
#include "llviewerinventory.h"
#include "llviewerkeyboard.h"
+#include "llviewermedia.h"
+#include "llviewermediafocus.h"
#include "llviewermenu.h"
#include "llviewermessage.h"
#include "llviewerobjectlist.h"
@@ -178,17 +179,25 @@
#include "llworldmapview.h"
#include "pipeline.h"
#include "llappviewer.h"
-#include "llurlsimstring.h"
#include "llviewerdisplay.h"
#include "llspatialpartition.h"
#include "llviewerjoystick.h"
#include "llviewernetwork.h"
#include "llpostprocess.h"
#include "llbottomtray.h"
+#include "llnearbychatbar.h"
+#include "llagentui.h"
+#include "llwearablelist.h"
+
+#include "llnotifications.h"
+#include "llnotificationsutil.h"
+#include "llnotificationmanager.h"
#include "llfloaternotificationsconsole.h"
-#include "llnearbychathistory.h"
+#include "llnearbychat.h"
+#include "llviewerwindowlistener.h"
+#include "llpaneltopinfobar.h"
#if LL_WINDOWS
#include <tchar.h> // For Unicode conversion methods
@@ -203,22 +212,14 @@ extern BOOL gDebugClicks;
extern BOOL gDisplaySwapBuffers;
extern BOOL gDepthDirty;
extern BOOL gResizeScreenTexture;
-extern S32 gJamesInt;
LLViewerWindow *gViewerWindow = NULL;
-
-BOOL gDebugSelect = FALSE;
-
-LLFrameTimer gMouseIdleTimer;
LLFrameTimer gAwayTimer;
LLFrameTimer gAwayTriggerTimer;
-LLFrameTimer gAlphaFadeTimer;
BOOL gShowOverlayTitle = FALSE;
-BOOL gPickTransparent = TRUE;
-BOOL gDebugFastUIRender = FALSE;
LLViewerObject* gDebugRaycastObject = NULL;
LLVector3 gDebugRaycastIntersection;
LLVector2 gDebugRaycastTexCoord;
@@ -229,8 +230,8 @@ S32 gDebugRaycastFaceHit;
// HUD display lines in lower right
BOOL gDisplayWindInfo = FALSE;
BOOL gDisplayCameraPos = FALSE;
-BOOL gDisplayNearestWater = FALSE;
BOOL gDisplayFOV = FALSE;
+BOOL gDisplayBadge = FALSE;
S32 CHAT_BAR_HEIGHT = 28;
S32 OVERLAY_BAR_HEIGHT = 20;
@@ -249,27 +250,27 @@ std::string LLViewerWindow::sSnapshotDir;
std::string LLViewerWindow::sMovieBaseName;
-extern void toggle_debug_menus(void*);
-
class RecordToChatConsole : public LLError::Recorder, public LLSingleton<RecordToChatConsole>
{
public:
virtual void recordMessage(LLError::ELevel level,
const std::string& message)
{
- // only log warnings to chat console
- if (level == LLError::LEVEL_WARN)
- {
- LLFloaterChat* chat_floater = LLFloaterReg::getTypedInstance<LLFloaterChat>("chat");
- if (chat_floater && gSavedSettings.getBOOL("WarningsAsChat"))
- {
- LLChat chat;
- chat.mText = message;
- chat.mSourceType = CHAT_SOURCE_SYSTEM;
+ //FIXME: this is NOT thread safe, and will do bad things when a warning is issued from a non-UI thread
- chat_floater->addChat(chat, FALSE, FALSE);
- }
- }
+ // only log warnings to chat console
+ //if (level == LLError::LEVEL_WARN)
+ //{
+ //LLFloaterChat* chat_floater = LLFloaterReg::findTypedInstance<LLFloaterChat>("chat");
+ //if (chat_floater && gSavedSettings.getBOOL("WarningsAsChat"))
+ //{
+ // LLChat chat;
+ // chat.mText = message;
+ // chat.mSourceType = CHAT_SOURCE_SYSTEM;
+
+ // chat_floater->addChat(chat, FALSE, FALSE);
+ //}
+ //}
}
};
@@ -315,7 +316,7 @@ public:
mTextColor = LLColor4( 0.86f, 0.86f, 0.86f, 1.f );
// Draw stuff growing up from right lower corner of screen
- U32 xpos = mWindow->getWindowWidth() - 350;
+ U32 xpos = mWindow->getWindowWidthScaled() - 350;
U32 ypos = 64;
const U32 y_inc = 20;
@@ -331,7 +332,9 @@ public:
S32 hours = (S32)(time / (60*60));
S32 mins = (S32)((time - hours*(60*60)) / 60);
S32 secs = (S32)((time - hours*(60*60) - mins*60));
- addText(xpos, ypos, llformat(" Debug %d: %d:%02d:%02d", idx, hours,mins,secs)); ypos += y_inc2;
+ std::string label = gDebugTimerLabel[idx];
+ if (label.empty()) label = llformat("Debug: %d", idx);
+ addText(xpos, ypos, llformat(" %s: %d:%02d:%02d", label.c_str(), hours,mins,secs)); ypos += y_inc2;
}
F32 time = gFrameTimeSeconds;
@@ -357,9 +360,9 @@ public:
agent_center_text = llformat("AgentCenter %f %f %f",
(F32)(tvector.mdV[VX]), (F32)(tvector.mdV[VY]), (F32)(tvector.mdV[VZ]));
- if (gAgent.getAvatarObject())
+ if (isAgentAvatarValid())
{
- tvector = gAgent.getPosGlobalFromAgent(gAgent.getAvatarObject()->mRoot.getWorldPosition());
+ tvector = gAgent.getPosGlobalFromAgent(gAgentAvatarp->mRoot.getWorldPosition());
agent_root_center_text = llformat("AgentRootCenter %f %f %f",
(F32)(tvector.mdV[VX]), (F32)(tvector.mdV[VY]), (F32)(tvector.mdV[VZ]));
}
@@ -377,7 +380,7 @@ public:
agent_left_text = llformat("AgentLeftAxis %f %f %f",
(F32)(tvector.mdV[VX]), (F32)(tvector.mdV[VY]), (F32)(tvector.mdV[VZ]));
- tvector = gAgent.getCameraPositionGlobal();
+ tvector = gAgentCamera.getCameraPositionGlobal();
camera_center_text = llformat("CameraCenter %f %f %f",
(F32)(tvector.mdV[VX]), (F32)(tvector.mdV[VY]), (F32)(tvector.mdV[VZ]));
@@ -418,6 +421,11 @@ public:
addText(xpos, ypos, llformat("FOV: %2.1f deg", RAD_TO_DEG * LLViewerCamera::getInstance()->getView()));
ypos += y_inc;
}
+ if (gDisplayBadge)
+ {
+ addText(xpos, ypos+(y_inc/2), llformat("Hippos!", RAD_TO_DEG * LLViewerCamera::getInstance()->getView()));
+ ypos += y_inc * 2;
+ }
/*if (LLViewerJoystick::getInstance()->getOverrideCamera())
{
@@ -476,6 +484,10 @@ public:
}
ypos += y_inc;
+ addText(xpos, ypos, llformat("UI Verts/Calls: %d/%d", LLRender::sUIVerts, LLRender::sUICalls));
+ LLRender::sUICalls = LLRender::sUIVerts = 0;
+ ypos += y_inc;
+
addText(xpos,ypos, llformat("%d/%d Nodes visible", gPipeline.mNumVisibleNodes, LLSpatialGroup::sNodeCount));
ypos += y_inc;
@@ -535,7 +547,7 @@ public:
ypos += y_inc;
}
// only display these messages if we are actually rendering beacons at this moment
- if (LLPipeline::getRenderBeacons(NULL) && gSavedSettings.getBOOL("BeaconAlwaysOn"))
+ if (LLPipeline::getRenderBeacons(NULL) && LLFloaterReg::instanceVisible("beacons"))
{
if (LLPipeline::getRenderParticleBeacons(NULL))
{
@@ -596,179 +608,129 @@ void LLViewerWindow::updateDebugText()
// LLViewerWindow
//
-bool LLViewerWindow::shouldShowToolTipFor(LLMouseHandler *mh)
-{
- if (mToolTip && mh)
- {
- LLMouseHandler::EShowToolTip showlevel = mh->getShowToolTip();
-
- return (
- showlevel == LLMouseHandler::SHOW_ALWAYS ||
- (showlevel == LLMouseHandler::SHOW_IF_NOT_BLOCKED &&
- !mToolTipBlocked)
- );
- }
- return false;
-}
-
BOOL LLViewerWindow::handleAnyMouseClick(LLWindow *window, LLCoordGL pos, MASK mask, LLMouseHandler::EClickType clicktype, BOOL down)
{
- std::string buttonname;
- std::string buttonstatestr;
- BOOL handled = FALSE;
+ const char* buttonname = "";
+ const char* buttonstatestr = "";
S32 x = pos.mX;
S32 y = pos.mY;
x = llround((F32)x / mDisplayScale.mV[VX]);
y = llround((F32)y / mDisplayScale.mV[VY]);
- if (down)
- {
- buttonstatestr = "down" ;
- }
- else
- {
- buttonstatestr = "up" ;
- }
-
- switch (clicktype)
- {
- case LLMouseHandler::CLICK_LEFT:
- mLeftMouseDown = down;
- buttonname = "Left";
- break;
- case LLMouseHandler::CLICK_RIGHT:
- mRightMouseDown = down;
- buttonname = "Right";
- break;
- case LLMouseHandler::CLICK_MIDDLE:
- mMiddleMouseDown = down;
- buttonname = "Middle";
- break;
- case LLMouseHandler::CLICK_DOUBLELEFT:
- mLeftMouseDown = down;
- buttonname = "Left Double Click";
- break;
- }
-
- LLView::sMouseHandlerMessage.clear();
-
- if (gMenuBarView)
- {
- // stop ALT-key access to menu
- gMenuBarView->resetMenuTrigger();
- }
-
- if (gDebugClicks)
+ // only send mouse clicks to UI if UI is visible
+ if(gPipeline.hasRenderDebugFeatureMask(LLPipeline::RENDER_DEBUG_FEATURE_UI))
{
- llinfos << "ViewerWindow " << buttonname << " mouse " << buttonstatestr << " at " << x << "," << y << llendl;
- }
- // Make sure we get a corresponding mouseup event, even if the mouse leaves the window
- if (down)
- mWindow->captureMouse();
- else
- mWindow->releaseMouse();
+ if (down)
+ {
+ buttonstatestr = "down" ;
+ }
+ else
+ {
+ buttonstatestr = "up" ;
+ }
+
+ switch (clicktype)
+ {
+ case LLMouseHandler::CLICK_LEFT:
+ mLeftMouseDown = down;
+ buttonname = "Left";
+ break;
+ case LLMouseHandler::CLICK_RIGHT:
+ mRightMouseDown = down;
+ buttonname = "Right";
+ break;
+ case LLMouseHandler::CLICK_MIDDLE:
+ mMiddleMouseDown = down;
+ buttonname = "Middle";
+ break;
+ case LLMouseHandler::CLICK_DOUBLELEFT:
+ mLeftMouseDown = down;
+ buttonname = "Left Double Click";
+ break;
+ }
+
+ LLView::sMouseHandlerMessage.clear();
- // Indicate mouse was active
- gMouseIdleTimer.reset();
+ if (gMenuBarView)
+ {
+ // stop ALT-key access to menu
+ gMenuBarView->resetMenuTrigger();
+ }
- // Hide tooltips on mousedown
- mToolTipBlocked = down;
+ if (gDebugClicks)
+ {
+ llinfos << "ViewerWindow " << buttonname << " mouse " << buttonstatestr << " at " << x << "," << y << llendl;
+ }
- // Also hide hover info on mousedown/mouseup
- if (gHoverView)
- {
- gHoverView->cancelHover();
- }
+ // Make sure we get a corresponding mouseup event, even if the mouse leaves the window
+ if (down)
+ mWindow->captureMouse();
+ else
+ mWindow->releaseMouse();
- // Don't let the user move the mouse out of the window until mouse up.
- if( LLToolMgr::getInstance()->getCurrentTool()->clipMouseWhenDown() )
- {
- mWindow->setMouseClipping(down);
- }
+ // Indicate mouse was active
+ LLUI::resetMouseIdleTimer();
- LLMouseHandler* mouse_captor = gFocusMgr.getMouseCapture();
- if( mouse_captor )
- {
- S32 local_x;
- S32 local_y;
- mouse_captor->screenPointToLocal( x, y, &local_x, &local_y );
- if (LLView::sDebugMouseHandling)
+ // Don't let the user move the mouse out of the window until mouse up.
+ if( LLToolMgr::getInstance()->getCurrentTool()->clipMouseWhenDown() )
{
- llinfos << buttonname << " Mouse " << buttonstatestr << " handled by captor " << mouse_captor->getName() << llendl;
+ mWindow->setMouseClipping(down);
}
- return mouse_captor->handleAnyMouseClick(local_x, local_y, mask, clicktype, down);
- }
- // Topmost view gets a chance before the hierarchy
- LLUICtrl* top_ctrl = gFocusMgr.getTopCtrl();
- if (top_ctrl)
- {
- S32 local_x, local_y;
- top_ctrl->screenPointToLocal( x, y, &local_x, &local_y );
- if (down)
+ LLMouseHandler* mouse_captor = gFocusMgr.getMouseCapture();
+ if( mouse_captor )
{
- if (top_ctrl->pointInView(local_x, local_y))
+ S32 local_x;
+ S32 local_y;
+ mouse_captor->screenPointToLocal( x, y, &local_x, &local_y );
+ if (LLView::sDebugMouseHandling)
{
- return top_ctrl->handleAnyMouseClick(local_x, local_y, mask, clicktype, down) ;
+ llinfos << buttonname << " Mouse " << buttonstatestr << " handled by captor " << mouse_captor->getName() << llendl;
}
- else
+ return mouse_captor->handleAnyMouseClick(local_x, local_y, mask, clicktype, down);
+ }
+
+ // Topmost view gets a chance before the hierarchy
+ //LLUICtrl* top_ctrl = gFocusMgr.getTopCtrl();
+ //if (top_ctrl)
+ //{
+ // S32 local_x, local_y;
+ // top_ctrl->screenPointToLocal( x, y, &local_x, &local_y );
+ // if (top_ctrl->pointInView(local_x, local_y))
+ // {
+ // return top_ctrl->handleAnyMouseClick(local_x, local_y, mask, clicktype, down) ;
+ // }
+ // else
+ // {
+ // if (down)
+ // {
+ // gFocusMgr.setTopCtrl(NULL);
+ // }
+ // }
+ //}
+
+ // Give the UI views a chance to process the click
+ if( mRootView->handleAnyMouseClick(x, y, mask, clicktype, down) )
+ {
+ if (LLView::sDebugMouseHandling)
{
- gFocusMgr.setTopCtrl(NULL);
+ llinfos << buttonname << " Mouse " << buttonstatestr << " " << LLView::sMouseHandlerMessage << llendl;
}
+ return TRUE;
}
- else
+ else if (LLView::sDebugMouseHandling)
{
- handled = top_ctrl->pointInView(local_x, local_y) && top_ctrl->handleMouseUp(local_x, local_y, mask);
+ llinfos << buttonname << " Mouse " << buttonstatestr << " not handled by view" << llendl;
}
}
- // Give the UI views a chance to process the click
- if( mRootView->handleAnyMouseClick(x, y, mask, clicktype, down) )
+ // Do not allow tool manager to handle mouseclicks if we have disconnected
+ if(!gDisconnected && LLToolMgr::getInstance()->getCurrentTool()->handleAnyMouseClick( x, y, mask, clicktype, down ) )
{
- if (LLView::sDebugMouseHandling)
- {
- llinfos << buttonname << " Mouse " << buttonstatestr << " " << LLView::sMouseHandlerMessage << llendl;
- }
return TRUE;
}
- else if (LLView::sDebugMouseHandling)
- {
- llinfos << buttonname << " Mouse " << buttonstatestr << " not handled by view" << llendl;
- }
-
- if (down)
- {
- if (gDisconnected)
- {
- return FALSE;
- }
-
- if(LLToolMgr::getInstance()->getCurrentTool()->handleAnyMouseClick( x, y, mask, clicktype, down ) )
- {
- // This is necessary to force clicks in the world to cause edit
- // boxes that might have keyboard focus to relinquish it, and hence
- // cause a commit to update their value. JC
- gFocusMgr.setKeyboardFocus(NULL);
- return TRUE;
- }
- }
- else
- {
- if( !handled )
- {
- handled = mRootView->handleAnyMouseClick(x, y, mask, clicktype, down);
- }
- if( !handled )
- {
- LLTool *tool = LLToolMgr::getInstance()->getCurrentTool();
- if (tool)
- {
- handled = tool->handleAnyMouseClick(x, y, mask, clicktype, down);
- }
- }
- }
// If we got this far on a down-click, it wasn't handled.
// Up-clicks, though, are always handled as far as the OS is concerned.
@@ -816,7 +778,7 @@ BOOL LLViewerWindow::handleRightMouseDown(LLWindow *window, LLCoordGL pos, MASK
// *HACK: this should be rolled into the composite tool logic, not
// hardcoded at the top level.
- if (CAMERA_MODE_CUSTOMIZE_AVATAR != gAgent.getCameraMode() && LLToolMgr::getInstance()->getCurrentTool() != LLToolPie::getInstance())
+ if (CAMERA_MODE_CUSTOMIZE_AVATAR != gAgentCamera.getCameraMode() && LLToolMgr::getInstance()->getCurrentTool() != LLToolPie::getInstance())
{
// If the current tool didn't process the click, we should show
// the pie menu. This can be done by passing the event to the pie
@@ -837,17 +799,161 @@ BOOL LLViewerWindow::handleRightMouseUp(LLWindow *window, LLCoordGL pos, MASK m
BOOL LLViewerWindow::handleMiddleMouseDown(LLWindow *window, LLCoordGL pos, MASK mask)
{
BOOL down = TRUE;
- gVoiceClient->middleMouseState(true);
+ LLVoiceClient::getInstance()->middleMouseState(true);
handleAnyMouseClick(window,pos,mask,LLMouseHandler::CLICK_MIDDLE,down);
// Always handled as far as the OS is concerned.
return TRUE;
}
+
+LLWindowCallbacks::DragNDropResult LLViewerWindow::handleDragNDrop( LLWindow *window, LLCoordGL pos, MASK mask, LLWindowCallbacks::DragNDropAction action, std::string data)
+{
+ LLWindowCallbacks::DragNDropResult result = LLWindowCallbacks::DND_NONE;
+
+ const bool prim_media_dnd_enabled = gSavedSettings.getBOOL("PrimMediaDragNDrop");
+ const bool slurl_dnd_enabled = gSavedSettings.getBOOL("SLURLDragNDrop");
+
+ if ( prim_media_dnd_enabled || slurl_dnd_enabled )
+ {
+ switch(action)
+ {
+ // Much of the handling for these two cases is the same.
+ case LLWindowCallbacks::DNDA_TRACK:
+ case LLWindowCallbacks::DNDA_DROPPED:
+ case LLWindowCallbacks::DNDA_START_TRACKING:
+ {
+ bool drop = (LLWindowCallbacks::DNDA_DROPPED == action);
+
+ if (slurl_dnd_enabled)
+ {
+ LLSLURL dropped_slurl(data);
+ if(dropped_slurl.isSpatial())
+ {
+ if (drop)
+ {
+ LLURLDispatcher::dispatch( dropped_slurl.getSLURLString(), NULL, true );
+ return LLWindowCallbacks::DND_MOVE;
+ }
+ return LLWindowCallbacks::DND_COPY;
+ }
+ }
+
+ if (prim_media_dnd_enabled)
+ {
+ LLPickInfo pick_info = pickImmediate( pos.mX, pos.mY, TRUE /*BOOL pick_transparent*/ );
+
+ LLUUID object_id = pick_info.getObjectID();
+ S32 object_face = pick_info.mObjectFace;
+ std::string url = data;
+
+ lldebugs << "Object: picked at " << pos.mX << ", " << pos.mY << " - face = " << object_face << " - URL = " << url << llendl;
+
+ LLVOVolume *obj = dynamic_cast<LLVOVolume*>(static_cast<LLViewerObject*>(pick_info.getObject()));
+
+ if (obj && !obj->getRegion()->getCapability("ObjectMedia").empty())
+ {
+ LLTextureEntry *te = obj->getTE(object_face);
+
+ // can modify URL if we can modify the object or we have navigate permissions
+ bool allow_modify_url = obj->permModify() || obj->hasMediaPermission( te->getMediaData(), LLVOVolume::MEDIA_PERM_INTERACT );
+
+ if (te && allow_modify_url )
+ {
+ if (drop)
+ {
+ // object does NOT have media already
+ if ( ! te->hasMedia() )
+ {
+ // we are allowed to modify the object
+ if ( obj->permModify() )
+ {
+ // Create new media entry
+ LLSD media_data;
+ // XXX Should we really do Home URL too?
+ media_data[LLMediaEntry::HOME_URL_KEY] = url;
+ media_data[LLMediaEntry::CURRENT_URL_KEY] = url;
+ media_data[LLMediaEntry::AUTO_PLAY_KEY] = true;
+ obj->syncMediaData(object_face, media_data, true, true);
+ // XXX This shouldn't be necessary, should it ?!?
+ if (obj->getMediaImpl(object_face))
+ obj->getMediaImpl(object_face)->navigateReload();
+ obj->sendMediaDataUpdate();
+
+ result = LLWindowCallbacks::DND_COPY;
+ }
+ }
+ else
+ // object HAS media already
+ {
+ // URL passes the whitelist
+ if (te->getMediaData()->checkCandidateUrl( url ) )
+ {
+ // just navigate to the URL
+ if (obj->getMediaImpl(object_face))
+ {
+ obj->getMediaImpl(object_face)->navigateTo(url);
+ }
+ else
+ {
+ // This is very strange. Navigation should
+ // happen via the Impl, but we don't have one.
+ // This sends it to the server, which /should/
+ // trigger us getting it. Hopefully.
+ LLSD media_data;
+ media_data[LLMediaEntry::CURRENT_URL_KEY] = url;
+ obj->syncMediaData(object_face, media_data, true, true);
+ obj->sendMediaDataUpdate();
+ }
+ result = LLWindowCallbacks::DND_LINK;
+
+ }
+ }
+ LLSelectMgr::getInstance()->unhighlightObjectOnly(mDragHoveredObject);
+ mDragHoveredObject = NULL;
+
+ }
+ else
+ {
+ // Check the whitelist, if there's media (otherwise just show it)
+ if (te->getMediaData() == NULL || te->getMediaData()->checkCandidateUrl(url))
+ {
+ if ( obj != mDragHoveredObject)
+ {
+ // Highlight the dragged object
+ LLSelectMgr::getInstance()->unhighlightObjectOnly(mDragHoveredObject);
+ mDragHoveredObject = obj;
+ LLSelectMgr::getInstance()->highlightObjectOnly(mDragHoveredObject);
+ }
+ result = (! te->hasMedia()) ? LLWindowCallbacks::DND_COPY : LLWindowCallbacks::DND_LINK;
+
+ }
+ }
+ }
+ }
+ }
+ }
+ break;
+
+ case LLWindowCallbacks::DNDA_STOP_TRACKING:
+ // The cleanup case below will make sure things are unhilighted if necessary.
+ break;
+ }
+
+ if (prim_media_dnd_enabled &&
+ result == LLWindowCallbacks::DND_NONE && !mDragHoveredObject.isNull())
+ {
+ LLSelectMgr::getInstance()->unhighlightObjectOnly(mDragHoveredObject);
+ mDragHoveredObject = NULL;
+ }
+ }
+
+ return result;
+}
BOOL LLViewerWindow::handleMiddleMouseUp(LLWindow *window, LLCoordGL pos, MASK mask)
{
BOOL down = FALSE;
- gVoiceClient->middleMouseState(false);
+ LLVoiceClient::getInstance()->middleMouseState(false);
handleAnyMouseClick(window,pos,mask,LLMouseHandler::CLICK_MIDDLE,down);
// Always handled as far as the OS is concerned.
@@ -867,13 +973,14 @@ void LLViewerWindow::handleMouseMove(LLWindow *window, LLCoordGL pos, MASK mask
// Save mouse point for access during idle() and display()
- LLCoordGL prev_saved_mouse_point = mCurrentMousePoint;
LLCoordGL mouse_point(x, y);
- saveLastMouse(mouse_point);
- BOOL mouse_actually_moved = !gFocusMgr.getMouseCapture() && // mouse is not currenty captured
- ((prev_saved_mouse_point.mX != mCurrentMousePoint.mX) || (prev_saved_mouse_point.mY != mCurrentMousePoint.mY)); // mouse moved from last recorded position
- gMouseIdleTimer.reset();
+ if (mouse_point != mCurrentMousePoint)
+ {
+ LLUI::resetMouseIdleTimer();
+ }
+
+ saveLastMouse(mouse_point);
mWindow->showCursorFromMouseMove();
@@ -881,17 +988,6 @@ void LLViewerWindow::handleMouseMove(LLWindow *window, LLCoordGL pos, MASK mask
{
gAgent.clearAFK();
}
-
- if(mouse_actually_moved)
- {
- mToolTipBlocked = FALSE;
- }
-
- // Activate the hover picker on mouse move.
- if (gHoverView)
- {
- gHoverView->setTyping(FALSE);
- }
}
void LLViewerWindow::handleMouseLeave(LLWindow *window)
@@ -899,10 +995,7 @@ void LLViewerWindow::handleMouseLeave(LLWindow *window)
// Note: we won't get this if we have captured the mouse.
llassert( gFocusMgr.getMouseCapture() == NULL );
mMouseInWindow = FALSE;
- if (mToolTip)
- {
- mToolTip->setVisible( FALSE );
- }
+ LLToolTipMgr::instance().blockToolTips();
}
BOOL LLViewerWindow::handleCloseRequest(LLWindow *window)
@@ -934,8 +1027,6 @@ void LLViewerWindow::handleFocus(LLWindow *window)
gAgent.onAppFocusGained();
LLToolMgr::getInstance()->onAppFocusGained();
- gShowTextEditCursor = TRUE;
-
// See if we're coming in with modifier keys held down
if (gKeyboard)
{
@@ -965,11 +1056,6 @@ void LLViewerWindow::handleFocusLost(LLWindow *window)
showCursor();
getWindow()->setMouseClipping(FALSE);
- // JC - Leave keyboard focus, so if you're popping in and out editing
- // a script, you don't have to click in the editor again and again.
- // gFocusMgr.setKeyboardFocus( NULL );
- gShowTextEditCursor = FALSE;
-
// If losing focus while keys are down, reset them.
if (gKeyboard)
{
@@ -984,7 +1070,7 @@ void LLViewerWindow::handleFocusLost(LLWindow *window)
BOOL LLViewerWindow::handleTranslatedKeyDown(KEY key, MASK mask, BOOL repeated)
{
// Let the voice chat code check for its PTT key. Note that this never affects event processing.
- gVoiceClient->keyDown(key, mask);
+ LLVoiceClient::getInstance()->keyDown(key, mask);
if (gAwayTimer.getElapsedTimeF32() > MIN_AFK_TIME)
{
@@ -1006,7 +1092,7 @@ BOOL LLViewerWindow::handleTranslatedKeyDown(KEY key, MASK mask, BOOL repeated)
BOOL LLViewerWindow::handleTranslatedKeyUp(KEY key, MASK mask)
{
// Let the voice chat code check for its PTT key. Note that this never affects event processing.
- gVoiceClient->keyUp(key, mask);
+ LLVoiceClient::getInstance()->keyUp(key, mask);
return FALSE;
}
@@ -1028,49 +1114,27 @@ BOOL LLViewerWindow::handleActivate(LLWindow *window, BOOL activated)
mActive = TRUE;
send_agent_resume();
gAgent.clearAFK();
- if (mWindow->getFullscreen() && !mIgnoreActivate)
- {
- if (!LLApp::isExiting() )
- {
- if (LLStartUp::getStartupState() >= STATE_STARTED)
- {
- // if we're in world, show a progress bar to hide reloading of textures
- llinfos << "Restoring GL during activate" << llendl;
- restoreGL("Restoring...");
- }
- else
- {
- // otherwise restore immediately
- restoreGL();
- }
- }
- else
- {
- llwarns << "Activating while quitting" << llendl;
- }
- }
-
+
// Unmute audio
audio_update_volume();
}
else
{
mActive = FALSE;
- if (gSavedSettings.getBOOL("AllowIdleAFK"))
+
+ if (gSavedSettings.getS32("AFKTimeout"))
{
gAgent.setAFK();
}
// SL-53351: Make sure we're not in mouselook when minimised, to prevent control issues
- gAgent.changeCameraToDefault();
-
- send_agent_pause();
-
- if (mWindow->getFullscreen() && !mIgnoreActivate)
+ if (gAgentCamera.getCameraMode() == CAMERA_MODE_MOUSELOOK)
{
- llinfos << "Stopping GL during deactivation" << llendl;
- stopGL();
+ gAgentCamera.changeCameraToDefault();
}
+
+ send_agent_pause();
+
// Mute audio
audio_update_volume();
}
@@ -1079,7 +1143,7 @@ BOOL LLViewerWindow::handleActivate(LLWindow *window, BOOL activated)
BOOL LLViewerWindow::handleActivateApp(LLWindow *window, BOOL activating)
{
- //if (!activating) gAgent.changeCameraToDefault();
+ //if (!activating) gAgentCamera.changeCameraToDefault();
LLViewerJoystick::getInstance()->setNeedsReset(true);
return FALSE;
@@ -1111,7 +1175,7 @@ BOOL LLViewerWindow::handlePaint(LLWindow *window, S32 x, S32 y, S32 width, S
FillRect(hdc, &wnd_rect, CreateSolidBrush(RGB(255, 255, 255)));
std::string name_str;
- gAgent.getName(name_str);
+ LLAgentUI::buildName(name_str);
std::string temp_str;
temp_str = llformat( "%s FPS %3.1f Phy FPS %2.1f Time Dil %1.3f", /* Flawfinder: ignore */
@@ -1160,7 +1224,7 @@ void LLViewerWindow::handleDataCopy(LLWindow *window, S32 data_type, void *data)
case SLURL_MESSAGE_TYPE:
// received URL
std::string url = (const char*)data;
- LLWebBrowserCtrl* web = NULL;
+ LLMediaCtrl* web = NULL;
const bool trusted_browser = false;
if (LLURLDispatcher::dispatch(url, web, trusted_browser))
{
@@ -1237,38 +1301,35 @@ LLViewerWindow::LLViewerWindow(
const std::string& title, const std::string& name,
S32 x, S32 y,
S32 width, S32 height,
- BOOL fullscreen, BOOL ignore_pixel_depth)
+ BOOL fullscreen, BOOL ignore_pixel_depth) // fullscreen is no longer used
:
mWindow(NULL),
mActive(TRUE),
- mWantFullscreen(fullscreen),
- mShowFullscreenProgress(FALSE),
- mWindowRect(0, height, width, 0),
- mVirtualWindowRect(0, height, width, 0),
- mWorldViewRect(0, height, width, 0),
+ mWindowRectRaw(0, height, width, 0),
+ mWindowRectScaled(0, height, width, 0),
+ mWorldViewRectRaw(0, height, width, 0),
mLeftMouseDown(FALSE),
mMiddleMouseDown(FALSE),
mRightMouseDown(FALSE),
- mToolTip(NULL),
- mToolTipBlocked(FALSE),
mMouseInWindow( FALSE ),
mLastMask( MASK_NONE ),
mToolStored( NULL ),
- mSuppressToolbox( FALSE ),
mHideCursorPermanent( FALSE ),
mCursorHidden(FALSE),
mIgnoreActivate( FALSE ),
- mHoverPick(),
mResDirty(false),
mStatesDirty(false),
- mIsFullscreenChecked(false),
- mCurrResolutionIndex(0)
+ mCurrResolutionIndex(0),
+ mViewerWindowListener(new LLViewerWindowListener(this)),
+ mProgressView(NULL)
{
LLNotificationChannel::buildChannel("VW_alerts", "Visible", LLNotificationFilters::filterBy<std::string>(&LLNotification::getType, "alert"));
LLNotificationChannel::buildChannel("VW_alertmodal", "Visible", LLNotificationFilters::filterBy<std::string>(&LLNotification::getType, "alertmodal"));
LLNotifications::instance().getChannel("VW_alerts")->connectChanged(&LLViewerWindow::onAlert);
LLNotifications::instance().getChannel("VW_alertmodal")->connectChanged(&LLViewerWindow::onAlert);
+ LLNotifications::instance().setIgnoreAllNotifications(gSavedSettings.getBOOL("IgnoreAllNotifications"));
+ llinfos << "NOTE: ALL NOTIFICATIONS THAT OCCUR WILL GET ADDED TO IGNORE LIST FOR LATER RUNS." << llendl;
// Default to application directory.
LLViewerWindow::sSnapshotBaseName = "Snapshot";
@@ -1283,7 +1344,7 @@ LLViewerWindow::LLViewerWindow(
gSavedSettings.getBOOL("DisableVerticalSync"),
!gNoRender,
ignore_pixel_depth,
- gSavedSettings.getU32("RenderFSAASamples"));
+ 0); //gSavedSettings.getU32("RenderFSAASamples"));
if (!LLAppViewer::instance()->restoreErrorTrap())
{
@@ -1293,7 +1354,7 @@ LLViewerWindow::LLViewerWindow(
if (NULL == mWindow)
{
- LLSplashScreen::update("Shutting down...");
+ LLSplashScreen::update(LLTrans::getString("ShuttingDown"));
#if LL_LINUX || LL_SOLARIS
llwarns << "Unable to create window, be sure screen is set at 32-bit color and your graphics driver is configured correctly. See README-linux.txt or README-solaris.txt for further information."
<< llendl;
@@ -1315,8 +1376,8 @@ LLViewerWindow::LLViewerWindow(
{
LLCoordWindow size;
mWindow->getSize(&size);
- mWindowRect.set(0, size.mY, size.mX, 0);
- mVirtualWindowRect.set(0, llround((F32)size.mY / mDisplayScale.mV[VY]), llround((F32)size.mX / mDisplayScale.mV[VX]), 0);
+ mWindowRectRaw.set(0, size.mY, size.mX, 0);
+ mWindowRectScaled.set(0, llround((F32)size.mY / mDisplayScale.mV[VY]), llround((F32)size.mX / mDisplayScale.mV[VX]), 0);
}
LLFontManager::initClass();
@@ -1339,6 +1400,7 @@ LLViewerWindow::LLViewerWindow(
if (LLFeatureManager::getInstance()->isSafe()
|| (gSavedSettings.getS32("LastFeatureVersion") != LLFeatureManager::getInstance()->getVersion())
+ || (gSavedSettings.getS32("LastGPUClass") != LLFeatureManager::getInstance()->getGPUClass())
|| (gSavedSettings.getBOOL("ProbeHardwareOnStartup")))
{
LLFeatureManager::getInstance()->applyRecommendedSettings();
@@ -1355,8 +1417,9 @@ LLViewerWindow::LLViewerWindow(
// Init the image list. Must happen after GL is initialized and before the images that
// LLViewerWindow needs are requested.
- gImageList.init();
- LLViewerImage::initClass();
+ LLImageGL::initClass(LLViewerTexture::MAX_GL_IMAGE_CATEGORY) ;
+ gTextureList.init();
+ LLViewerTextureManager::init() ;
gBumpImageList.init();
// Init font system, but don't actually load the fonts yet
@@ -1371,15 +1434,15 @@ LLViewerWindow::LLViewerWindow(
// Create container for all sub-views
LLView::Params rvp;
rvp.name("root");
- rvp.rect(mVirtualWindowRect);
+ rvp.rect(mWindowRectScaled);
rvp.mouse_opaque(false);
rvp.follows.flags(FOLLOWS_NONE);
mRootView = LLUICtrlFactory::create<LLRootView>(rvp);
LLUI::setRootView(mRootView);
// Make avatar head look forward at start
- mCurrentMousePoint.mX = getWindowWidth() / 2;
- mCurrentMousePoint.mY = getWindowHeight() / 2;
+ mCurrentMousePoint.mX = getWindowWidthScaled() / 2;
+ mCurrentMousePoint.mY = getWindowHeightScaled() / 2;
gShowOverlayTitle = gSavedSettings.getBOOL("ShowOverlayTitle");
mOverlayTitle = gSavedSettings.getString("OverlayTitle");
@@ -1391,6 +1454,7 @@ LLViewerWindow::LLViewerWindow(
mDebugText = new LLDebugText(this);
+ mWorldViewRectScaled = calcScaledRect(mWorldViewRectRaw, mDisplayScale);
}
void LLViewerWindow::initGLDefaults()
@@ -1424,10 +1488,14 @@ void LLViewerWindow::initGLDefaults()
gCylinder.prerender();
}
+struct MainPanel : public LLPanel
+{
+};
+
void LLViewerWindow::initBase()
{
- S32 height = getWindowHeight();
- S32 width = getWindowWidth();
+ S32 height = getWindowHeightScaled();
+ S32 width = getWindowWidthScaled();
LLRect full_window(0, height, width, 0);
@@ -1447,29 +1515,22 @@ 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();
+ main_view->buildFromFile("main_view.xml");
+ main_view->setShape(full_window);
+ getRootView()->addChild(main_view);
+
+ // 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->findChild<LLPopupView>("popup_holder");
+ mHintHolder = main_view->getChild<LLView>("hint_holder")->getHandle();
// 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 = main_view->getChild<LLFloaterView>("Floater View");
+ gSnapshotFloaterView = main_view->getChild<LLSnapshotFloaterView>("Snapshot Floater View");
- // Snapshot floater must start invisible otherwise it eats all
- // the tooltips. JC
- gSnapshotFloaterView->setVisible(FALSE);
// Console
llassert( !gConsole );
@@ -1481,7 +1542,7 @@ void LLViewerWindow::initBase()
cp.font_size_index(gSavedSettings.getS32("ChatFontSize"));
cp.follows.flags(FOLLOWS_LEFT | FOLLOWS_RIGHT | FOLLOWS_BOTTOM);
gConsole = LLUICtrlFactory::create<LLConsole>(cp);
- mRootView->addChild(gConsole);
+ getRootView()->addChild(gConsole);
// optionally forward warnings to chat console/chat floater
// for qa runs and dev builds
@@ -1494,51 +1555,22 @@ 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);
- mRootView->addChild(gDebugView);
-
- // Add floater view at the end so it will be on top, and give it tab priority over others
- mRootView->addChild(gFloaterView, -1);
- mRootView->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);
- mRootView->addChild(gNotifyBoxView, -2);
-
- // Tooltips go above floaters
- LLTextBox::Params params;
- params.text("tool tip");
- params.name(params.text);
- params.rect(LLRect (0, 1, 1, 0));
- params.h_pad(4);
- params.v_pad(2);
- params.text_color(gSavedSkinSettings.getColor( "ToolTipTextColor" ));
- params.border_color(gSavedSkinSettings.getColor( "ToolTipBorderColor" ));
- params.border_visible(false);
- params.background_color(gSavedSkinSettings.getColor( "ToolTipBgColor" ));
- params.bg_visible(true);
- params.font.style("NORMAL");
- params.border_drop_shadow_visible(true);
- params.visible(false);
- mToolTip = LLUICtrlFactory::create<LLTextBox> (params);
+ gDebugView = getRootView()->getChild<LLDebugView>("DebugView");
+ gDebugView->init();
+ gToolTipView = getRootView()->getChild<LLToolTipView>("tooltip view");
+
+ // Initialize busy response message when logged in
+ LLAppViewer::instance()->setOnLoginCompletedCallback(boost::bind(&LLFloaterPreference::initBusyResponse));
// Add the progress bar view (startup view), which overrides everything
- mProgressView = new LLProgressView(full_window);
- mRootView->addChild(mProgressView);
+ mProgressView = getRootView()->findChild<LLProgressView>("progress_view");
setShowProgress(FALSE);
setProgressCancelButtonVisible(FALSE);
+
+ gMenuHolder = getRootView()->getChild<LLViewerMenuHolderGL>("Menu Holder");
+
+ LLMenuGL::sMenuContainer = gMenuHolder;
+
}
void LLViewerWindow::initWorldUI()
@@ -1547,39 +1579,19 @@ void LLViewerWindow::initWorldUI()
S32 width = mRootView->getRect().getWidth();
LLRect full_window(0, height, width, 0);
- gIMMgr = LLIMMgr::getInstance();
- // new bottom panel
- LLRect rc = LLBottomTray::getInstance()->getRect();
- rc.mLeft = 0;
- rc.mRight = mRootView->getRect().getWidth();
- mRootView->addChild(LLBottomTray::getInstance());
- LLBottomTray::getInstance()->reshape(rc.getWidth(),rc.getHeight(),FALSE);
- LLBottomTray::getInstance()->setRect(rc);
-
- // Updating of bottom boundary of gConsole to avoid overlapping
- if (gConsole)
- {
- LLRect cr = gConsole->getRect();
- cr.mBottom += LLBottomTray::getInstance()->getRect().getHeight();
- gConsole->setRect(cr);
- }
-
- // View for hover information
- LLHoverView::Params hvp;
- hvp.name("gHoverview");
- hvp.rect(full_window);
- gHoverView = LLUICtrlFactory::create<LLHoverView>(hvp);
- mRootView->addChild(gHoverView);
+ gIMMgr = LLIMMgr::getInstance();
- // Pre initialize instance communicate instance;
- // currently needs to happen before initializing chat or IM
- LLFloaterReg::getInstance("communicate");
+ //getRootView()->sendChildToFront(gFloaterView);
+ //getRootView()->sendChildToFront(gSnapshotFloaterView);
- if ( gSavedPerAccountSettings.getBOOL("LogShowHistory") )
- {
- LLFloaterChat::loadHistory();
- }
+ // 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);
LLRect morph_view_rect = full_window;
morph_view_rect.stretch( -STATUS_BAR_HEIGHT );
@@ -1589,62 +1601,93 @@ void LLViewerWindow::initWorldUI()
mvp.rect(morph_view_rect);
mvp.visible(false);
gMorphView = LLUICtrlFactory::create<LLMorphView>(mvp);
- mRootView->addChild(gMorphView);
-
- // Make space for nav bar.
- LLRect floater_view_rect = gFloaterView->getRect();
- LLRect notify_view_rect = gNotifyBoxView->getRect();
- floater_view_rect.mTop -= NAVIGATION_BAR_HEIGHT;
- floater_view_rect.mBottom += LLBottomTray::getInstance()->getRect().getHeight();
- notify_view_rect.mTop -= NAVIGATION_BAR_HEIGHT;
- notify_view_rect.mBottom += LLBottomTray::getInstance()->getRect().getHeight();
- gFloaterView->setRect(floater_view_rect);
- gNotifyBoxView->setRect(notify_view_rect);
-
- // *Note: this is where gFloaterMute used to be initialized.
+ getRootView()->addChild(gMorphView);
LLWorldMapView::initClass();
// Force gFloaterWorldMap to initialize
LLFloaterReg::getInstance("world_map");
- LLFloaterReg::hideInstance("world_map");
// Force gFloaterTools to initialize
LLFloaterReg::getInstance("build");
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->setFollowsAll();
+ 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->setVisible(TRUE);
// Navigation bar
+ LLPanel* nav_bar_container = getRootView()->getChild<LLPanel>("nav_bar_container");
LLNavigationBar* navbar = LLNavigationBar::getInstance();
- 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->setShape(nav_bar_container->getLocalRect());
navbar->setBackgroundColor(gMenuBarView->getBackgroundColor().get());
+ nav_bar_container->addChild(navbar);
+ nav_bar_container->setVisible(TRUE);
- getRootView()->addChild(gStatusBar);
- getRootView()->addChild(navbar);
+ if (!gSavedSettings.getBOOL("ShowNavbarNavigationPanel"))
+ {
+ navbar->showNavigationPanel(FALSE);
+ }
- // side tray
- getRootView()->addChild(LLSideTray::getInstance());
+ if (!gSavedSettings.getBOOL("ShowNavbarFavoritesPanel"))
+ {
+ navbar->showFavoritesPanel(FALSE);
+ }
+
+ // Top Info bar
+ LLPanel* topinfo_bar_container = getRootView()->getChild<LLPanel>("topinfo_bar_container");
+ LLPanelTopInfoBar* topinfo_bar = LLPanelTopInfoBar::getInstance();
+
+ topinfo_bar->setShape(topinfo_bar_container->getLocalRect());
- //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);
+ topinfo_bar_container->addChild(topinfo_bar);
+ topinfo_bar_container->setVisible(TRUE);
+
+ if (!gSavedSettings.getBOOL("ShowMiniLocationPanel"))
+ {
+ topinfo_bar->setVisible(FALSE);
+ }
+
+ if ( gHUDView == NULL )
+ {
+ LLRect hud_rect = full_window;
+ hud_rect.mBottom += 50;
+ if (gMenuBarView)
+ {
+ hud_rect.mTop -= gMenuBarView->getRect().getHeight();
+ }
+ gHUDView = new LLHUDView(hud_rect);
+ // put behind everything else in the UI
+ getRootView()->addChildInBack(gHUDView);
+ }
+
+ LLPanel* panel_ssf_container = getRootView()->getChild<LLPanel>("stand_stop_flying_container");
+ LLPanelStandStopFlying* panel_stand_stop_flying = LLPanelStandStopFlying::getInstance();
+ 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);
}
// Destroy the UI
@@ -1661,7 +1704,19 @@ void LLViewerWindow::shutdownViews()
{
gMorphView->setVisible(FALSE);
}
+
+ // DEV-40930: Clear sModalStack. Otherwise, any LLModalDialog left open
+ // will crump with LL_ERRS.
+ LLModalDialog::shutdownModals();
+ // destroy the nav bar, not currently part of gViewerWindow
+ // *TODO: Make LLNavigationBar part of gViewerWindow
+ delete LLNavigationBar::getInstance();
+
+ // destroy menus after instantiating navbar above, as it needs
+ // access to gMenuHolder
+ cleanup_menus();
+
// Delete all child views.
delete mRootView;
mRootView = NULL;
@@ -1669,17 +1724,12 @@ void LLViewerWindow::shutdownViews()
// Automatically deleted as children of mRootView. Fix the globals.
gStatusBar = NULL;
gIMMgr = NULL;
- gHoverView = NULL;
+ gToolTipView = NULL;
- gFloaterView = NULL;
- gMorphView = NULL;
+ gFloaterView = NULL;
+ gMorphView = NULL;
gHUDView = NULL;
-
- gNotifyBoxView = NULL;
-
- delete mToolTip;
- mToolTip = NULL;
}
void LLViewerWindow::shutdownGL()
@@ -1694,7 +1744,9 @@ void LLViewerWindow::shutdownGL()
gSky.cleanup();
stop_glerror();
- gImageList.shutdown();
+ LLWearableList::instance().cleanup() ;
+
+ gTextureList.shutdown();
stop_glerror();
gBumpImageList.shutdown();
@@ -1706,8 +1758,11 @@ void LLViewerWindow::shutdownGL()
gPipeline.cleanup();
stop_glerror();
- LLViewerImage::cleanupClass();
-
+ LLViewerTextureManager::cleanup() ;
+ LLImageGL::cleanupClass() ;
+
+ llinfos << "All textures and llimagegl images are destroyed!" << llendl ;
+
llinfos << "Cleaning up select manager" << llendl;
LLSelectMgr::getInstance()->cleanup();
@@ -1728,6 +1783,9 @@ LLViewerWindow::~LLViewerWindow()
{
llinfos << "Destroying Window" << llendl;
destroyWindow();
+
+ delete mDebugText;
+ mDebugText = NULL;
}
@@ -1745,12 +1803,6 @@ void LLViewerWindow::showCursor()
void LLViewerWindow::hideCursor()
{
- // Hide tooltips
- if(mToolTip ) mToolTip->setVisible( FALSE );
-
- // Also hide hover info
- if (gHoverView) gHoverView->cancelHover();
-
// And hide the cursor
mWindow->hideCursor();
@@ -1768,8 +1820,8 @@ void LLViewerWindow::sendShapeToSim()
msg->addU32Fast(_PREHASH_CircuitCode, gMessageSystem->mOurCircuitCode);
msg->nextBlockFast(_PREHASH_HeightWidthBlock);
msg->addU32Fast(_PREHASH_GenCounter, 0);
- U16 height16 = (U16) mWorldViewRect.getHeight();
- U16 width16 = (U16) mWorldViewRect.getWidth();
+ U16 height16 = (U16) mWorldViewRectRaw.getHeight();
+ U16 width16 = (U16) mWorldViewRectRaw.getWidth();
msg->addU16Fast(_PREHASH_Height, height16);
msg->addU16Fast(_PREHASH_Width, width16);
gAgent.sendReliableMessage();
@@ -1791,14 +1843,14 @@ void LLViewerWindow::reshape(S32 width, S32 height)
}
// update our window rectangle
- mWindowRect.mRight = mWindowRect.mLeft + width;
- mWindowRect.mTop = mWindowRect.mBottom + height;
+ mWindowRectRaw.mRight = mWindowRectRaw.mLeft + width;
+ mWindowRectRaw.mTop = mWindowRectRaw.mBottom + height;
//glViewport(0, 0, width, height );
if (height > 0)
{
- LLViewerCamera::getInstance()->setViewHeightInPixels( mWorldViewRect.getHeight() );
+ LLViewerCamera::getInstance()->setViewHeightInPixels( mWorldViewRectRaw.getHeight() );
LLViewerCamera::getInstance()->setAspect( getWorldViewAspectRatio() );
}
@@ -1808,8 +1860,8 @@ void LLViewerWindow::reshape(S32 width, S32 height)
LLUI::setScaleFactor(mDisplayScale);
// update our window rectangle
- mVirtualWindowRect.mRight = mVirtualWindowRect.mLeft + llround((F32)width / mDisplayScale.mV[VX]);
- mVirtualWindowRect.mTop = mVirtualWindowRect.mBottom + llround((F32)height / mDisplayScale.mV[VY]);
+ mWindowRectScaled.mRight = mWindowRectScaled.mLeft + llround((F32)width / mDisplayScale.mV[VX]);
+ mWindowRectScaled.mTop = mWindowRectScaled.mBottom + llround((F32)height / mDisplayScale.mV[VY]);
setup2DViewport();
@@ -1827,24 +1879,17 @@ void LLViewerWindow::reshape(S32 width, S32 height)
sendShapeToSim();
-
- // store the mode the user wants (even if not there yet)
- gSavedSettings.setBOOL("NotFullScreen", !mWantFullscreen);
-
// store new settings for the mode we are in, regardless
- if (!mWindow->getFullscreen())
- {
- // Only save size if not maximized
- BOOL maximized = mWindow->getMaximized();
- gSavedSettings.setBOOL("WindowMaximized", maximized);
+ // Only save size if not maximized
+ BOOL maximized = mWindow->getMaximized();
+ gSavedSettings.setBOOL("WindowMaximized", maximized);
- LLCoordScreen window_size;
- if (!maximized
- && mWindow->getSize(&window_size))
- {
- gSavedSettings.setS32("WindowWidth", window_size.mX);
- gSavedSettings.setS32("WindowHeight", window_size.mY);
- }
+ LLCoordScreen window_size;
+ if (!maximized
+ && mWindow->getSize(&window_size))
+ {
+ gSavedSettings.setS32("WindowWidth", window_size.mX);
+ gSavedSettings.setS32("WindowHeight", window_size.mY);
}
LLViewerStats::getInstance()->setStat(LLViewerStats::ST_WINDOW_WIDTH, (F64)width);
@@ -1856,8 +1901,11 @@ void LLViewerWindow::reshape(S32 width, S32 height)
// Hide normal UI when a logon fails
void LLViewerWindow::setNormalControlsVisible( BOOL visible )
{
- LLBottomTray::getInstance()->setVisible(visible);
- LLBottomTray::getInstance()->setEnabled(visible);
+ if(LLBottomTray::instanceExists())
+ {
+ LLBottomTray::getInstance()->setVisible(visible);
+ LLBottomTray::getInstance()->setEnabled(visible);
+ }
if ( gMenuBarView )
{
@@ -1866,7 +1914,7 @@ void LLViewerWindow::setNormalControlsVisible( BOOL visible )
// ...and set the menu color appropriately.
setMenuBackgroundColor(gAgent.getGodLevel() > GOD_NOT,
- LLViewerLogin::getInstance()->isInProductionGrid());
+ LLGridManager::getInstance()->isInProductionGrid());
}
if ( gStatusBar )
@@ -1887,21 +1935,30 @@ void LLViewerWindow::setMenuBackgroundColor(bool god_mode, bool dev_grid)
LLSD args;
LLColor4 new_bg_color;
- if(god_mode && LLViewerLogin::getInstance()->isInProductionGrid())
+ // no l10n problem because channel is always an english string
+ std::string channel = LLVersionInfo::getChannel();
+ bool isProject = (channel.find("Project") != std::string::npos);
+
+ // god more important than project, proj more important than grid
+ if(god_mode && LLGridManager::getInstance()->isInProductionGrid())
{
- new_bg_color = gSavedSkinSettings.getColor( "MenuBarGodBgColor" );
+ new_bg_color = LLUIColorTable::instance().getColor( "MenuBarGodBgColor" );
}
- else if(god_mode && !LLViewerLogin::getInstance()->isInProductionGrid())
+ else if(god_mode && !LLGridManager::getInstance()->isInProductionGrid())
{
- new_bg_color = gSavedSkinSettings.getColor( "MenuNonProductionGodBgColor" );
+ new_bg_color = LLUIColorTable::instance().getColor( "MenuNonProductionGodBgColor" );
+ }
+ else if (!god_mode && isProject)
+ {
+ new_bg_color = LLUIColorTable::instance().getColor( "MenuBarProjectBgColor" );
}
- else if(!god_mode && !LLViewerLogin::getInstance()->isInProductionGrid())
+ else if(!god_mode && !LLGridManager::getInstance()->isInProductionGrid())
{
- new_bg_color = gSavedSkinSettings.getColor( "MenuNonProductionBgColor" );
+ new_bg_color = LLUIColorTable::instance().getColor( "MenuNonProductionBgColor" );
}
else
{
- new_bg_color = gSavedSkinSettings.getColor( "MenuBarBgColor" );
+ new_bg_color = LLUIColorTable::instance().getColor( "MenuBarBgColor" );
}
if(gMenuBarView)
@@ -1912,7 +1969,6 @@ void LLViewerWindow::setMenuBackgroundColor(bool god_mode, bool dev_grid)
if(gStatusBar)
{
gStatusBar->setBackgroundColor( new_bg_color );
- gStatusBar->getChild<LLTextBox>("HealthText")->setBackgroundColor(new_bg_color);
}
}
@@ -1920,21 +1976,24 @@ void LLViewerWindow::drawDebugText()
{
gGL.color4f(1,1,1,1);
gGL.pushMatrix();
+ gGL.pushUIMatrix();
{
// scale view by UI global scale factor and aspect ratio correction factor
- glScalef(mDisplayScale.mV[VX], mDisplayScale.mV[VY], 1.f);
+ gGL.scaleUI(mDisplayScale.mV[VX], mDisplayScale.mV[VY], 1.f);
mDebugText->draw();
}
+ gGL.popUIMatrix();
gGL.popMatrix();
+
gGL.flush();
}
void LLViewerWindow::draw()
{
-#if LL_DEBUG
+//#if LL_DEBUG
LLView::sIsDrawing = TRUE;
-#endif
+//#endif
stop_glerror();
LLUI::setLineWidth(1.f);
@@ -1947,6 +2006,11 @@ void LLViewerWindow::draw()
//S32 screen_x, screen_y;
+ if (!gSavedSettings.getBOOL("RenderUIBuffer"))
+ {
+ LLUI::sDirtyRect = getWindowRectScaled();
+ }
+
// HACK for timecode debugging
if (gSavedSettings.getBOOL("DisplayTimecode"))
{
@@ -1958,8 +2022,8 @@ void LLViewerWindow::draw()
microsecondsToTimecodeString(gFrameTime,text);
const LLFontGL* font = LLFontGL::getFontSansSerif();
font->renderUTF8(text, 0,
- llround((getWindowWidth()/2)-100.f),
- llround((getWindowHeight()-60.f)),
+ llround((getWindowWidthScaled()/2)-100.f),
+ llround((getWindowHeightScaled()-60.f)),
LLColor4( 1.f, 1.f, 1.f, 1.f ),
LLFontGL::LEFT, LLFontGL::TOP);
}
@@ -1968,9 +2032,11 @@ void LLViewerWindow::draw()
// No translation needed, this view is glued to 0,0
gGL.pushMatrix();
+ LLUI::pushMatrix();
{
+
// scale view by UI global scale factor and aspect ratio correction factor
- glScalef(mDisplayScale.mV[VX], mDisplayScale.mV[VY], 1.f);
+ gGL.scaleUI(mDisplayScale.mV[VX], mDisplayScale.mV[VY], 1.f);
LLVector2 old_scale_factor = LLUI::sGLScaleFactor;
// apply camera zoom transform (for high res screenshots)
@@ -1982,8 +2048,8 @@ void LLViewerWindow::draw()
int pos_y = sub_region / llceil(zoom_factor);
int pos_x = sub_region - (pos_y*llceil(zoom_factor));
// offset for this tile
- glTranslatef((F32)getWindowWidth() * -(F32)pos_x,
- (F32)getWindowHeight() * -(F32)pos_y,
+ glTranslatef((F32)getWindowWidthScaled() * -(F32)pos_x,
+ (F32)getWindowHeightScaled() * -(F32)pos_y,
0.f);
glScalef(zoom_factor, zoom_factor, 1.f);
LLUI::sGLScaleFactor *= zoom_factor;
@@ -1992,7 +2058,7 @@ void LLViewerWindow::draw()
// Draw tool specific overlay on world
LLToolMgr::getInstance()->getCurrentTool()->draw();
- if( gAgent.cameraMouselook() )
+ if( gAgentCamera.cameraMouselook() || LLFloaterCamera::inFreeCameraMode() )
{
drawMouselookInstructions();
stop_glerror();
@@ -2002,6 +2068,11 @@ void LLViewerWindow::draw()
// No translation needed, this view is glued to 0,0
mRootView->draw();
+ if (LLView::sDebugRects)
+ {
+ gToolTipView->drawStickyRect();
+ }
+
// Draw optional on-top-of-everyone view
LLUICtrl* top_ctrl = gFocusMgr.getTopCtrl();
if (top_ctrl && top_ctrl->getVisible())
@@ -2016,31 +2087,6 @@ void LLViewerWindow::draw()
LLUI::popMatrix();
}
- // Draw tooltips
- // Adjust their rectangle so they don't go off the top or bottom
- // of the screen.
- if( mToolTip && mToolTip->getVisible() )
- {
- glMatrixMode(GL_MODELVIEW);
- LLUI::pushMatrix();
- {
- S32 tip_height = mToolTip->getRect().getHeight();
-
- S32 screen_x, screen_y;
- mToolTip->localPointToScreen(0, -24 - tip_height,
- &screen_x, &screen_y);
-
- // If tooltip would draw off the bottom of the screen,
- // show it from the cursor tip position.
- if (screen_y < tip_height)
- {
- mToolTip->localPointToScreen(0, 0, &screen_x, &screen_y);
- }
- LLUI::translate( (F32) screen_x, (F32) screen_y, 0);
- mToolTip->draw();
- }
- LLUI::popMatrix();
- }
if( gShowOverlayTitle && !mOverlayTitle.empty() )
{
@@ -2048,149 +2094,127 @@ void LLViewerWindow::draw()
const S32 DIST_FROM_TOP = 20;
LLFontGL::getFontSansSerifBig()->renderUTF8(
mOverlayTitle, 0,
- llround( getWindowWidth() * 0.5f),
- getWindowHeight() - DIST_FROM_TOP,
+ llround( getWindowWidthScaled() * 0.5f),
+ getWindowHeightScaled() - DIST_FROM_TOP,
LLColor4(1, 1, 1, 0.4f),
LLFontGL::HCENTER, LLFontGL::TOP);
}
LLUI::sGLScaleFactor = old_scale_factor;
}
+ LLUI::popMatrix();
gGL.popMatrix();
-#if LL_DEBUG
+//#if LL_DEBUG
LLView::sIsDrawing = FALSE;
-#endif
-
- // UI post-draw Updates
- gNotifyBoxView->updateNotifyBoxView();
+//#endif
}
// Takes a single keydown event, usually when UI is visible
BOOL LLViewerWindow::handleKey(KEY key, MASK mask)
{
+ // hide tooltips on keypress
+ LLToolTipMgr::instance().blockToolTips();
+
if (gFocusMgr.getKeyboardFocus()
&& !(mask & (MASK_CONTROL | MASK_ALT))
&& !gFocusMgr.getKeystrokesOnly())
{
// We have keyboard focus, and it's not an accelerator
-
if (key < 0x80)
{
// Not a special key, so likely (we hope) to generate a character. Let it fall through to character handler first.
- return gFocusMgr.childHasKeyboardFocus(mRootView);
+ return (gFocusMgr.getKeyboardFocus() != NULL);
}
}
- //// HACK look for UI editing keys
- //if (LLView::sEditingUI)
- //{
- // if (LLFloaterEditUI::processKeystroke(key, mask))
- // {
- // return TRUE;
- // }
- //}
-
- // Hide tooltips on keypress
- mToolTipBlocked = TRUE; // block until next time mouse is moved
-
- // Also hide hover info on keypress
- if (gHoverView)
+ // let menus handle navigation keys for navigation
+ if ((gMenuBarView && gMenuBarView->handleKey(key, mask, TRUE))
+ ||(gLoginMenuBarView && gLoginMenuBarView->handleKey(key, mask, TRUE))
+ ||(gMenuHolder && gMenuHolder->handleKey(key, mask, TRUE)))
{
- gHoverView->cancelHover();
-
- gHoverView->setTyping(TRUE);
+ return TRUE;
}
- // Explicit hack for debug menu.
- if ((MASK_ALT & mask) &&
- (MASK_CONTROL & mask) &&
- ('D' == key || 'd' == key))
- {
- toggle_debug_menus(NULL);
- }
+ LLFocusableElement* keyboard_focus = gFocusMgr.getKeyboardFocus();
- // Explicit hack for debug menu.
- if ((mask == (MASK_SHIFT | MASK_CONTROL)) &&
- ('G' == key || 'g' == key))
+ // give menus a chance to handle modified (Ctrl, Alt) shortcut keys before current focus
+ // as long as focus isn't locked
+ if (mask & (MASK_CONTROL | MASK_ALT) && !gFocusMgr.focusLocked())
{
- if (LLStartUp::getStartupState() < STATE_LOGIN_CLEANUP) //on splash page
+ // Check the current floater's menu first, if it has one.
+ if (gFocusMgr.keyboardFocusHasAccelerators()
+ && keyboard_focus
+ && keyboard_focus->handleKey(key,mask,FALSE))
{
- BOOL visible = ! gSavedSettings.getBOOL("ForceShowGrid");
- gSavedSettings.setBOOL("ForceShowGrid", visible);
+ return TRUE;
+ }
- // Initialize visibility (and don't force visibility - use prefs)
- LLPanelLogin::refreshLocation( false );
+ if ((gMenuBarView && gMenuBarView->handleAcceleratorKey(key, mask))
+ ||(gLoginMenuBarView && gLoginMenuBarView->handleAcceleratorKey(key, mask)))
+ {
+ return TRUE;
}
}
- // Debugging view for unified notifications: CTRL-SHIFT-5
- // *FIXME: Having this special-cased right here (just so this can be invoked from the login screen) sucks.
- if ((MASK_SHIFT & mask)
- && (!(MASK_ALT & mask))
- && (MASK_CONTROL & mask)
- && ('5' == key))
+ // give floaters first chance to handle TAB key
+ // so frontmost floater gets focus
+ // if nothing has focus, go to first or last UI element as appropriate
+ if (key == KEY_TAB && (mask & MASK_CONTROL || gFocusMgr.getKeyboardFocus() == NULL))
{
- LLFloaterNotificationConsole::showInstance();
- return TRUE;
- }
+ if (gMenuHolder) gMenuHolder->hideMenus();
- // handle escape key
- //if (key == KEY_ESCAPE && mask == MASK_NONE)
- //{
+ // if CTRL-tabbing (and not just TAB with no focus), go into window cycle mode
+ gFloaterView->setCycleMode((mask & MASK_CONTROL) != 0);
- // *TODO: get this to play well with mouselook and hidden
- // cursor modes, etc, and re-enable.
- //if (gFocusMgr.getMouseCapture())
- //{
- // gFocusMgr.setMouseCapture(NULL);
- // return TRUE;
- //}
- //}
-
- // let menus handle navigation keys
- if (gMenuBarView && gMenuBarView->handleKey(key, mask, TRUE))
- {
+ // do CTRL-TAB and CTRL-SHIFT-TAB logic
+ if (mask & MASK_SHIFT)
+ {
+ mRootView->focusPrevRoot();
+ }
+ else
+ {
+ mRootView->focusNextRoot();
+ }
return TRUE;
}
- // let menus handle navigation keys
- if (gLoginMenuBarView && gLoginMenuBarView->handleKey(key, mask, TRUE))
+ // hidden edit menu for cut/copy/paste
+ if (gEditMenu && gEditMenu->handleAcceleratorKey(key, mask))
{
return TRUE;
}
// Traverses up the hierarchy
- LLUICtrl* keyboard_focus = gFocusMgr.getKeyboardFocus();
if( keyboard_focus )
{
+ LLLineEditor* chat_editor = LLBottomTray::instanceExists() ? LLBottomTray::getInstance()->getNearbyChatBar()->getChatBox() : NULL;
// arrow keys move avatar while chatting hack
- if (gChatBar && gChatBar->inputEditorHasFocus())
+ if (chat_editor && chat_editor->hasFocus())
{
- if (gChatBar->getCurrentChat().empty() || gSavedSettings.getBOOL("ArrowKeysMoveAvatar"))
+ // If text field is empty, there's no point in trying to move
+ // cursor with arrow keys, so allow movement
+ if (chat_editor->getText().empty()
+ || gSavedSettings.getBOOL("ArrowKeysAlwaysMove"))
{
- switch(key)
+ // let Control-Up and Control-Down through for chat line history,
+ if (!(key == KEY_UP && mask == MASK_CONTROL)
+ && !(key == KEY_DOWN && mask == MASK_CONTROL))
{
- case KEY_LEFT:
- case KEY_RIGHT:
- case KEY_UP:
- // let CTRL UP through for chat line history
- if( MASK_CONTROL == mask )
- {
- break;
- }
- case KEY_DOWN:
- // let CTRL DOWN through for chat line history
- if( MASK_CONTROL == mask )
+ switch(key)
{
+ case KEY_LEFT:
+ case KEY_RIGHT:
+ case KEY_UP:
+ case KEY_DOWN:
+ case KEY_PAGE_UP:
+ case KEY_PAGE_DOWN:
+ case KEY_HOME:
+ // when chatbar is empty or ArrowKeysAlwaysMove set,
+ // pass arrow keys on to avatar...
+ return FALSE;
+ default:
break;
}
- case KEY_PAGE_UP:
- case KEY_PAGE_DOWN:
- case KEY_HOME:
- // when chatbar is empty or ArrowKeysMoveAvatar set, pass arrow keys on to avatar...
- return FALSE;
- default:
- break;
}
}
}
@@ -2207,7 +2231,7 @@ BOOL LLViewerWindow::handleKey(KEY key, MASK mask)
}
// Try for a new-format gesture
- if (gGestureManager.triggerGesture(key, mask))
+ if (LLGestureMgr::instance().triggerGesture(key, mask))
{
return TRUE;
}
@@ -2219,50 +2243,10 @@ BOOL LLViewerWindow::handleKey(KEY key, MASK mask)
return TRUE;
}
- // Topmost view gets a chance before the hierarchy
- // *FIX: get rid of this?
- //LLUICtrl* top_ctrl = gFocusMgr.getTopCtrl();
- //if (top_ctrl)
- //{
- // if( top_ctrl->handleKey( key, mask, TRUE ) )
- // {
- // return TRUE;
- // }
- //}
-
- // give floaters first chance to handle TAB key
- // so frontmost floater gets focus
- if (key == KEY_TAB)
- {
- // if nothing has focus, go to first or last UI element as appropriate
- if (mask & MASK_CONTROL || gFocusMgr.getKeyboardFocus() == NULL)
- {
- if (gMenuHolder) gMenuHolder->hideMenus();
- // if CTRL-tabbing (and not just TAB with no focus), go into window cycle mode
- gFloaterView->setCycleMode((mask & MASK_CONTROL) != 0);
-
- // do CTRL-TAB and CTRL-SHIFT-TAB logic
- if (mask & MASK_SHIFT)
- {
- mRootView->focusPrevRoot();
- }
- else
- {
- mRootView->focusNextRoot();
- }
- return TRUE;
- }
- }
-
- // give menus a chance to handle keys
- if (gMenuBarView && gMenuBarView->handleAcceleratorKey(key, mask))
- {
- return TRUE;
- }
-
- // give menus a chance to handle keys
- if (gLoginMenuBarView && gLoginMenuBarView->handleAcceleratorKey(key, mask))
+ // give menus a chance to handle unmodified accelerator keys
+ if ((gMenuBarView && gMenuBarView->handleAcceleratorKey(key, mask))
+ ||(gLoginMenuBarView && gLoginMenuBarView->handleAcceleratorKey(key, mask)))
{
return TRUE;
}
@@ -2294,7 +2278,7 @@ BOOL LLViewerWindow::handleUnicodeChar(llwchar uni_char, MASK mask)
}
// Traverses up the hierarchy
- LLView* keyboard_focus = gFocusMgr.getKeyboardFocus();
+ LLFocusableElement* keyboard_focus = gFocusMgr.getKeyboardFocus();
if( keyboard_focus )
{
if (keyboard_focus->handleUnicodeChar(uni_char, FALSE))
@@ -2320,14 +2304,8 @@ void LLViewerWindow::handleScrollWheel(S32 clicks)
{
LLView::sMouseHandlerMessage.clear();
- gMouseIdleTimer.reset();
-
- // Hide tooltips
- if( mToolTip )
- {
- mToolTip->setVisible( FALSE );
- }
-
+ LLUI::resetMouseIdleTimer();
+
LLMouseHandler* mouse_captor = gFocusMgr.getMouseCapture();
if( mouse_captor )
{
@@ -2365,36 +2343,120 @@ void LLViewerWindow::handleScrollWheel(S32 clicks)
}
// Zoom the camera in and out behavior
- gAgent.handleScrollWheel(clicks);
+
+ if(top_ctrl == 0
+ && getWorldViewRectScaled().pointInRect(mCurrentMousePoint.mX, mCurrentMousePoint.mY)
+ && gAgentCamera.isInitialized())
+ gAgentCamera.handleScrollWheel(clicks);
return;
}
+void LLViewerWindow::addPopup(LLView* popup)
+{
+ if (mPopupView)
+ {
+ mPopupView->addPopup(popup);
+ }
+}
+
+void LLViewerWindow::removePopup(LLView* popup)
+{
+ if (mPopupView)
+ {
+ mPopupView->removePopup(popup);
+ }
+}
+
+void LLViewerWindow::clearPopups()
+{
+ if (mPopupView)
+ {
+ mPopupView->clearPopups();
+ }
+}
+
void LLViewerWindow::moveCursorToCenter()
{
- S32 x = mWorldViewRect.getWidth() / 2;
- S32 y = mWorldViewRect.getHeight() / 2;
+ if (! gSavedSettings.getBOOL("DisableMouseWarp"))
+ {
+ S32 x = getWorldViewWidthScaled() / 2;
+ S32 y = getWorldViewHeightScaled() / 2;
- //on a forced move, all deltas get zeroed out to prevent jumping
- mCurrentMousePoint.set(x,y);
- mLastMousePoint.set(x,y);
- mCurrentMouseDelta.set(0,0);
+ //on a forced move, all deltas get zeroed out to prevent jumping
+ mCurrentMousePoint.set(x,y);
+ mLastMousePoint.set(x,y);
+ mCurrentMouseDelta.set(0,0);
- LLUI::setCursorPositionScreen(x, y);
+ LLUI::setMousePositionScreen(x, y);
+ }
}
+
//////////////////////////////////////////////////////////////////////
//
// Hover handlers
//
+void append_xui_tooltip(LLView* viewp, LLToolTip::Params& params)
+{
+ if (viewp)
+ {
+ if (!params.styled_message.empty())
+ {
+ params.styled_message.add().text("\n---------\n");
+ }
+ LLView::root_to_view_iterator_t end_tooltip_it = viewp->endRootToView();
+ // NOTE: we skip "root" since it is assumed
+ for (LLView::root_to_view_iterator_t tooltip_it = ++viewp->beginRootToView();
+ tooltip_it != end_tooltip_it;
+ ++tooltip_it)
+ {
+ LLView* viewp = *tooltip_it;
+
+ params.styled_message.add().text(viewp->getName());
+
+ LLPanel* panelp = dynamic_cast<LLPanel*>(viewp);
+ if (panelp && !panelp->getXMLFilename().empty())
+ {
+ params.styled_message.add()
+ .text("(" + panelp->getXMLFilename() + ")")
+ .style.color(LLColor4(0.7f, 0.7f, 1.f, 1.f));
+ }
+ params.styled_message.add().text("/");
+ }
+ }
+}
+
// Update UI based on stored mouse position from mouse-move
// event processing.
void LLViewerWindow::updateUI()
{
+ static LLFastTimer::DeclareTimer ftm("Update UI");
+ LLFastTimer t(ftm);
+
static std::string last_handle_msg;
- updateWorldViewRect();
+ if (gLoggedInTime.getStarted())
+ {
+ if (gLoggedInTime.getElapsedTimeF32() > gSavedSettings.getF32("DestinationGuideHintTimeout"))
+ {
+ LLFirstUse::notUsingDestinationGuide();
+ }
+ if (gLoggedInTime.getElapsedTimeF32() > gSavedSettings.getF32("SidePanelHintTimeout"))
+ {
+ LLFirstUse::notUsingSidePanel();
+ }
+ }
+
+ LLConsole::updateClass();
+
+ // animate layout stacks so we have up to date rect for world view
+ LLLayoutStack::updateClass();
+
+ // use full window for world view when not rendering UI
+ bool world_view_uses_full_window = gAgentCamera.cameraMouselook() || !gPipeline.hasRenderDebugFeatureMask(LLPipeline::RENDER_DEBUG_FEATURE_UI);
+ updateWorldViewRect(world_view_uses_full_window);
LLView::sMouseHandlerMessage.clear();
@@ -2407,6 +2469,17 @@ void LLViewerWindow::updateUI()
return;
}
+ if (gPipeline.hasRenderDebugMask(LLPipeline::RENDER_DEBUG_RAYCAST))
+ {
+ gDebugRaycastFaceHit = -1;
+ gDebugRaycastObject = cursorIntersect(-1, -1, 512.f, NULL, -1, FALSE,
+ &gDebugRaycastFaceHit,
+ &gDebugRaycastIntersection,
+ &gDebugRaycastTexCoord,
+ &gDebugRaycastNormal,
+ &gDebugRaycastBinormal);
+ }
+
updateMouseDelta();
updateKeyboardFocus();
@@ -2415,64 +2488,118 @@ void LLViewerWindow::updateUI()
BOOL handled_by_top_ctrl = FALSE;
LLUICtrl* top_ctrl = gFocusMgr.getTopCtrl();
LLMouseHandler* mouse_captor = gFocusMgr.getMouseCapture();
+ LLView* captor_view = dynamic_cast<LLView*>(mouse_captor);
+
+ //FIXME: only include captor and captor's ancestors if mouse is truly over them --RN
//build set of views containing mouse cursor by traversing UI hierarchy and testing
//screen rect against mouse cursor
view_handle_set_t mouse_hover_set;
- // start at current mouse captor (if is a view) or UI root
- LLView* root_view = NULL;
- root_view = dynamic_cast<LLView*>(mouse_captor);
+ // constraint mouse enter events to children of mouse captor
+ LLView* root_view = captor_view;
+
+ // if mouse captor doesn't exist or isn't a LLView
+ // then allow mouse enter events on entire UI hierarchy
if (!root_view)
{
root_view = mRootView;
}
- // walk UI tree in depth-first order
- LLView::tree_iterator_t end_it;
- for (LLView::tree_iterator_t it = root_view->beginTree();
- it != end_it;
- ++it)
+ // only update mouse hover set when UI is visible (since we shouldn't send hover events to invisible UI
+ if (gPipeline.hasRenderDebugFeatureMask(LLPipeline::RENDER_DEBUG_FEATURE_UI))
{
- LLView* viewp = *it;
- // calculating the screen rect involves traversing the parent, so this is less than optimal
- if (!viewp->getVisible()
- || !viewp->calcScreenBoundingRect().pointInRect(x, y))
+ // include all ancestors of captor_view as automatically having mouse
+ if (captor_view)
{
- // skip this view and all of its children
- it.skipDescendants();
- continue;
+ LLView* captor_parent_view = captor_view->getParent();
+ while(captor_parent_view)
+ {
+ mouse_hover_set.insert(captor_parent_view->getHandle());
+ captor_parent_view = captor_parent_view->getParent();
+ }
}
- // if this view is mouse opaque, nothing behind it should be in mouse_hover_set
- if (viewp->getMouseOpaque())
+ // aggregate visible views that contain mouse cursor in display order
+ LLPopupView::popup_list_t popups = mPopupView->getCurrentPopups();
+
+ for(LLPopupView::popup_list_t::iterator popup_it = popups.begin(); popup_it != popups.end(); ++popup_it)
{
- // constrain further iteration to children of this widget
- it = viewp->beginTree();
+ LLView* popup = popup_it->get();
+ if (popup && popup->calcScreenBoundingRect().pointInRect(x, y))
+ {
+ // iterator over contents of top_ctrl, and throw into mouse_hover_set
+ for (LLView::tree_iterator_t it = popup->beginTreeDFS();
+ it != popup->endTreeDFS();
+ ++it)
+ {
+ LLView* viewp = *it;
+ if (viewp->getVisible()
+ && viewp->calcScreenBoundingRect().pointInRect(x, y))
+ {
+ // we have a view that contains the mouse, add it to the set
+ mouse_hover_set.insert(viewp->getHandle());
+ }
+ else
+ {
+ // skip this view and all of its children
+ it.skipDescendants();
+ }
+ }
+ }
}
- // we have a view that contains the mouse, add it to the set
- mouse_hover_set.insert(viewp->getHandle());
- }
-
- // now do the same aggregation for the "top" ctrl, whose parent does not necessarily contain the mouse
- if (top_ctrl)
- {
- for (LLView::tree_iterator_t it = top_ctrl->beginTree();
- it != root_view->endTree();
- ++it)
+ // while the top_ctrl contains the mouse cursor, only it and its descendants will receive onMouseEnter events
+ if (top_ctrl && top_ctrl->calcScreenBoundingRect().pointInRect(x, y))
{
- LLView* viewp = *it;
- if (!viewp->getVisible()
- || !viewp->calcScreenBoundingRect().pointInRect(x, y))
+ // iterator over contents of top_ctrl, and throw into mouse_hover_set
+ for (LLView::tree_iterator_t it = top_ctrl->beginTreeDFS();
+ it != top_ctrl->endTreeDFS();
+ ++it)
{
- // skip this view and all of its children
- it.skipDescendants();
- continue;
+ LLView* viewp = *it;
+ if (viewp->getVisible()
+ && viewp->calcScreenBoundingRect().pointInRect(x, y))
+ {
+ // we have a view that contains the mouse, add it to the set
+ mouse_hover_set.insert(viewp->getHandle());
+ }
+ else
+ {
+ // skip this view and all of its children
+ it.skipDescendants();
+ }
}
+ }
+ else
+ {
+ // walk UI tree in depth-first order
+ for (LLView::tree_iterator_t it = root_view->beginTreeDFS();
+ it != root_view->endTreeDFS();
+ ++it)
+ {
+ LLView* viewp = *it;
+ // calculating the screen rect involves traversing the parent, so this is less than optimal
+ if (viewp->getVisible()
+ && viewp->calcScreenBoundingRect().pointInRect(x, y))
+ {
- // we have a view that contains the mouse, add it to the set
- mouse_hover_set.insert(viewp->getHandle());
+ // if this view is mouse opaque, nothing behind it should be in mouse_hover_set
+ if (viewp->getMouseOpaque())
+ {
+ // constrain further iteration to children of this widget
+ it = viewp->beginTreeDFS();
+ }
+
+ // we have a view that contains the mouse, add it to the set
+ mouse_hover_set.insert(viewp->getHandle());
+ }
+ else
+ {
+ // skip this view and all of its children
+ it.skipDescendants();
+ }
+ }
}
}
@@ -2515,148 +2642,170 @@ void LLViewerWindow::updateUI()
// store resulting hover set for next frame
swap(mMouseHoverViews, mouse_hover_set);
- if( mouse_captor )
- {
- // Pass hover events to object capturing mouse events.
- S32 local_x;
- S32 local_y;
- mouse_captor->screenPointToLocal( x, y, &local_x, &local_y );
- handled = mouse_captor->handleHover(local_x, local_y, mask);
- if (LLView::sDebugMouseHandling)
- {
- llinfos << "Hover handled by captor " << mouse_captor->getName() << llendl;
- }
+ // only handle hover events when UI is enabled
+ if (gPipeline.hasRenderDebugFeatureMask(LLPipeline::RENDER_DEBUG_FEATURE_UI))
+ {
- if( !handled )
+ if( mouse_captor )
{
- lldebugst(LLERR_USER_INPUT) << "hover not handled by mouse captor" << llendl;
+ // Pass hover events to object capturing mouse events.
+ S32 local_x;
+ S32 local_y;
+ mouse_captor->screenPointToLocal( x, y, &local_x, &local_y );
+ handled = mouse_captor->handleHover(local_x, local_y, mask);
+ if (LLView::sDebugMouseHandling)
+ {
+ llinfos << "Hover handled by captor " << mouse_captor->getName() << llendl;
+ }
+
+ if( !handled )
+ {
+ lldebugst(LLERR_USER_INPUT) << "hover not handled by mouse captor" << llendl;
+ }
}
- }
- else
- {
- if (top_ctrl)
+ else
{
- S32 local_x, local_y;
- top_ctrl->screenPointToLocal( x, y, &local_x, &local_y );
- handled = top_ctrl->pointInView(local_x, local_y) && top_ctrl->handleHover(local_x, local_y, mask);
- handled_by_top_ctrl = TRUE;
- }
+ if (top_ctrl)
+ {
+ S32 local_x, local_y;
+ top_ctrl->screenPointToLocal( x, y, &local_x, &local_y );
+ handled = top_ctrl->pointInView(local_x, local_y) && top_ctrl->handleHover(local_x, local_y, mask);
+ handled_by_top_ctrl = TRUE;
+ }
- if ( !handled )
- {
- // x and y are from last time mouse was in window
- // mMouseInWindow tracks *actual* mouse location
- if (mMouseInWindow && mRootView->handleHover(x, y, mask) )
+ if ( !handled )
{
- if (LLView::sDebugMouseHandling && LLView::sMouseHandlerMessage != last_handle_msg)
+ // x and y are from last time mouse was in window
+ // mMouseInWindow tracks *actual* mouse location
+ if (mMouseInWindow && mRootView->handleHover(x, y, mask) )
{
- last_handle_msg = LLView::sMouseHandlerMessage;
- llinfos << "Hover" << LLView::sMouseHandlerMessage << llendl;
+ if (LLView::sDebugMouseHandling && LLView::sMouseHandlerMessage != last_handle_msg)
+ {
+ last_handle_msg = LLView::sMouseHandlerMessage;
+ llinfos << "Hover" << LLView::sMouseHandlerMessage << llendl;
+ }
+ handled = TRUE;
+ }
+ else if (LLView::sDebugMouseHandling)
+ {
+ if (last_handle_msg != LLStringUtil::null)
+ {
+ last_handle_msg.clear();
+ llinfos << "Hover not handled by view" << llendl;
+ }
}
- handled = TRUE;
}
- else if (LLView::sDebugMouseHandling)
+
+ if (!handled)
{
- if (last_handle_msg != LLStringUtil::null)
+ LLTool *tool = LLToolMgr::getInstance()->getCurrentTool();
+
+ if(mMouseInWindow && tool)
{
- last_handle_msg.clear();
- llinfos << "Hover not handled by view" << llendl;
+ handled = tool->handleHover(x, y, mask);
}
}
}
- if( !handled )
- {
- lldebugst(LLERR_USER_INPUT) << "hover not handled by top view or root" << llendl;
- }
- }
-
- // *NOTE: sometimes tools handle the mouse as a captor, so this
- // logic is a little confusing
- LLTool *tool = NULL;
- if (gHoverView)
- {
- tool = LLToolMgr::getInstance()->getCurrentTool();
-
- if(!handled && tool)
+ // Show a new tool tip (or update one that is already shown)
+ BOOL tool_tip_handled = FALSE;
+ std::string tool_tip_msg;
+ if( handled
+ && !mWindow->isCursorHidden())
{
- handled = tool->handleHover(x, y, mask);
+ LLRect screen_sticky_rect = mRootView->getLocalRect();
+ S32 local_x, local_y;
- if (!mWindow->isCursorHidden())
+ if (gSavedSettings.getBOOL("DebugShowXUINames"))
{
- gHoverView->updateHover(tool);
- }
- }
- else
- {
- // Cancel hovering if any UI element handled the event.
- gHoverView->cancelHover();
- }
+ LLToolTip::Params params;
- // Suppress the toolbox view if our source tool was the pie tool,
- // and we've overridden to something else.
- mSuppressToolbox =
- (LLToolMgr::getInstance()->getBaseTool() == LLToolPie::getInstance()) &&
- (LLToolMgr::getInstance()->getCurrentTool() != LLToolPie::getInstance());
+ LLView* tooltip_view = mRootView;
+ LLView::tree_iterator_t end_it = mRootView->endTreeDFS();
+ for (LLView::tree_iterator_t it = mRootView->beginTreeDFS(); it != end_it; ++it)
+ {
+ LLView* viewp = *it;
+ LLRect screen_rect;
+ viewp->localRectToScreen(viewp->getLocalRect(), &screen_rect);
+ if (!(viewp->getVisible()
+ && screen_rect.pointInRect(x, y)))
+ {
+ it.skipDescendants();
+ }
+ // only report xui names for LLUICtrls,
+ // and blacklist the various containers we don't care about
+ else if (dynamic_cast<LLUICtrl*>(viewp)
+ && viewp != gMenuHolder
+ && viewp != gFloaterView
+ && viewp != gConsole)
+ {
+ if (dynamic_cast<LLFloater*>(viewp))
+ {
+ // constrain search to descendants of this (frontmost) floater
+ // by resetting iterator
+ it = viewp->beginTreeDFS();
+ }
- }
+ // if we are in a new part of the tree (not a descendent of current tooltip_view)
+ // then push the results for tooltip_view and start with a new potential view
+ // NOTE: this emulates visiting only the leaf nodes that meet our criteria
+ if (!viewp->hasAncestor(tooltip_view))
+ {
+ append_xui_tooltip(tooltip_view, params);
+ screen_sticky_rect.intersectWith(tooltip_view->calcScreenRect());
+ }
+ tooltip_view = viewp;
+ }
+ }
- // Show a new tool tip (or update one that is alrady shown)
- BOOL tool_tip_handled = FALSE;
- std::string tool_tip_msg;
- F32 tooltip_delay = gSavedSettings.getF32( "ToolTipDelay" );
- //HACK: hack for tool-based tooltips which need to pop up more quickly
- //Also for show xui names as tooltips debug mode
- if ((mouse_captor && !mouse_captor->isView()) || LLUI::sShowXUINames)
- {
- tooltip_delay = gSavedSettings.getF32( "DragAndDropToolTipDelay" );
- }
- if( handled &&
- gMouseIdleTimer.getElapsedTimeF32() > tooltip_delay &&
- !mWindow->isCursorHidden() )
- {
- LLRect screen_sticky_rect;
- LLMouseHandler *mh;
- S32 local_x, local_y;
- if (mouse_captor)
- {
- mouse_captor->screenPointToLocal(x, y, &local_x, &local_y);
- mh = mouse_captor;
- }
- else if (handled_by_top_ctrl)
- {
- top_ctrl->screenPointToLocal(x, y, &local_x, &local_y);
- mh = top_ctrl;
- }
- else
- {
- local_x = x; local_y = y;
- mh = mRootView;
- }
+ append_xui_tooltip(tooltip_view, params);
+ screen_sticky_rect.intersectWith(tooltip_view->calcScreenRect());
+
+ params.sticky_rect = screen_sticky_rect;
+ params.max_width = 400;
- BOOL tooltip_vis = FALSE;
- if (shouldShowToolTipFor(mh))
- {
- tool_tip_handled = mh->handleToolTip(local_x, local_y, tool_tip_msg, &screen_sticky_rect );
-
- if( tool_tip_handled && !tool_tip_msg.empty() )
+ LLToolTipMgr::instance().show(params);
+ }
+ // if there is a mouse captor, nothing else gets a tooltip
+ else if (mouse_captor)
{
- mToolTipStickyRect = screen_sticky_rect;
- mToolTip->setWrappedText( tool_tip_msg, 200 );
- mToolTip->reshapeToFitText();
- mToolTip->setOrigin( x, y );
- LLRect virtual_window_rect(0, getWindowHeight(), getWindowWidth(), 0);
- mToolTip->translateIntoRect( virtual_window_rect, FALSE );
- tooltip_vis = TRUE;
+ mouse_captor->screenPointToLocal(x, y, &local_x, &local_y);
+ tool_tip_handled = mouse_captor->handleToolTip(local_x, local_y, mask);
}
- }
+ else
+ {
+ // next is top_ctrl
+ if (!tool_tip_handled && top_ctrl)
+ {
+ top_ctrl->screenPointToLocal(x, y, &local_x, &local_y);
+ tool_tip_handled = top_ctrl->handleToolTip(local_x, local_y, mask );
+ }
+
+ if (!tool_tip_handled)
+ {
+ local_x = x; local_y = y;
+ tool_tip_handled = mRootView->handleToolTip(local_x, local_y, mask );
+ }
+
+ LLTool* current_tool = LLToolMgr::getInstance()->getCurrentTool();
+ if (!tool_tip_handled && current_tool)
+ {
+ current_tool->screenPointToLocal(x, y, &local_x, &local_y);
+ tool_tip_handled = current_tool->handleToolTip(local_x, local_y, mask );
+ }
+ }
+ }
+ }
+ else
+ { // just have tools handle hover when UI is turned off
+ LLTool *tool = LLToolMgr::getInstance()->getCurrentTool();
- if (mToolTip)
+ if(mMouseInWindow && tool)
{
- mToolTip->setVisible( tooltip_vis );
+ handled = tool->handleHover(x, y, mask);
}
- }
-
+ }
+
updateLayout();
mLastMousePoint = mCurrentMousePoint;
@@ -2671,61 +2820,8 @@ void LLViewerWindow::updateUI()
{
LLSelectMgr::getInstance()->deselectUnused();
}
-
- updatePicking(x, y, mask);
}
-void LLViewerWindow::updatePicking(S32 x, S32 y, MASK mask)
-{
- // per frame picking - for tooltips and changing cursor over interactive objects
- static S32 previous_x = -1;
- static S32 previous_y = -1;
- static BOOL mouse_moved_since_pick = FALSE;
-
- if (gPipeline.hasRenderDebugMask(LLPipeline::RENDER_DEBUG_RAYCAST))
- {
- gDebugRaycastFaceHit = -1;
- gDebugRaycastObject = cursorIntersect(-1, -1, 512.f, NULL, -1, FALSE,
- &gDebugRaycastFaceHit,
- &gDebugRaycastIntersection,
- &gDebugRaycastTexCoord,
- &gDebugRaycastNormal,
- &gDebugRaycastBinormal);
- }
-
-
- if ((previous_x != x) || (previous_y != y))
- mouse_moved_since_pick = TRUE;
-
- BOOL do_pick = FALSE;
-
- F32 picks_moving = gSavedSettings.getF32("PicksPerSecondMouseMoving");
- if ((mouse_moved_since_pick) && (picks_moving > 0.0) && (mPickTimer.getElapsedTimeF32() > 1.0f / picks_moving))
- {
- do_pick = TRUE;
- }
-
- F32 picks_stationary = gSavedSettings.getF32("PicksPerSecondMouseStationary");
- if ((!mouse_moved_since_pick) && (picks_stationary > 0.0) && (mPickTimer.getElapsedTimeF32() > 1.0f / picks_stationary))
- {
- do_pick = TRUE;
- }
-
- if (getCursorHidden())
- {
- do_pick = FALSE;
- }
-
- if (do_pick)
- {
- mouse_moved_since_pick = FALSE;
- mPickTimer.reset();
- pickAsync(getCurrentMouseX(), getCurrentMouseY(), mask, hoverPickCallback, TRUE);
- }
-
- previous_x = x;
- previous_y = y;
-}
void LLViewerWindow::updateLayout()
{
@@ -2737,6 +2833,12 @@ void LLViewerWindow::updateLayout()
&& tool != LLToolDragAndDrop::getInstance()
&& !gSavedSettings.getBOOL("FreezeTime"))
{
+ // Suppress the toolbox view if our source tool was the pie tool,
+ // and we've overridden to something else.
+ bool suppress_toolbox =
+ (LLToolMgr::getInstance()->getBaseTool() == LLToolPie::getInstance()) &&
+ (LLToolMgr::getInstance()->getCurrentTool() != LLToolPie::getInstance());
+
LLMouseHandler *captor = gFocusMgr.getMouseCapture();
// With the null, inspect, or drag and drop tool, don't muck
// with visibility.
@@ -2744,10 +2846,10 @@ void LLViewerWindow::updateLayout()
if (gFloaterTools->isMinimized()
|| (tool != LLToolPie::getInstance() // not default tool
&& tool != LLToolCompGun::getInstance() // not coming out of mouselook
- && !mSuppressToolbox // not override in third person
+ && !suppress_toolbox // not override in third person
&& LLToolMgr::getInstance()->getCurrentToolset() != gFaceEditToolset // not special mode
&& LLToolMgr::getInstance()->getCurrentToolset() != gMouselookToolset
- && (!captor || captor->isView()))) // not dragging
+ && (!captor || dynamic_cast<LLView*>(captor) != NULL))) // not dragging
{
// Force floater tools to be visible (unless minimized)
if (!gFloaterTools->getVisible())
@@ -2762,7 +2864,15 @@ void LLViewerWindow::updateLayout()
{
gFloaterTools->setVisible(FALSE);
}
- gMenuBarView->setItemVisible("BuildTools", gFloaterTools->getVisible());
+ //gMenuBarView->setItemVisible("BuildTools", gFloaterTools->getVisible());
+ }
+
+ // Always update console
+ if(gConsole)
+ {
+ LLRect console_rect = getChatConsoleRect();
+ gConsole->reshape(console_rect.getWidth(), console_rect.getHeight());
+ gConsole->setRect(console_rect);
}
}
@@ -2776,8 +2886,8 @@ void LLViewerWindow::updateMouseDelta()
mWindow->getCursorPosition(&mouse_pos);
if (mouse_pos.mX < 0 ||
mouse_pos.mY < 0 ||
- mouse_pos.mX > mWindowRect.getWidth() ||
- mouse_pos.mY > mWindowRect.getHeight())
+ mouse_pos.mX > mWindowRectRaw.getWidth() ||
+ mouse_pos.mY > mWindowRectRaw.getHeight())
{
mMouseInWindow = FALSE;
}
@@ -2811,13 +2921,20 @@ void LLViewerWindow::updateMouseDelta()
void LLViewerWindow::updateKeyboardFocus()
{
+ if (!gPipeline.hasRenderDebugFeatureMask(LLPipeline::RENDER_DEBUG_FEATURE_UI))
+ {
+ gFocusMgr.setKeyboardFocus(NULL);
+ }
+
// clean up current focus
- LLUICtrl* cur_focus = gFocusMgr.getKeyboardFocus();
+ LLUICtrl* cur_focus = dynamic_cast<LLUICtrl*>(gFocusMgr.getKeyboardFocus());
if (cur_focus)
{
if (!cur_focus->isInVisibleChain() || !cur_focus->isInEnabledChain())
{
- gFocusMgr.releaseFocusIfNeeded(cur_focus);
+ // don't release focus, just reassign so that if being given
+ // to a sibling won't call onFocusLost on all the ancestors
+ // gFocusMgr.releaseFocusIfNeeded(cur_focus);
LLUICtrl* parent = cur_focus->getParentUICtrl();
const LLUICtrl* focus_root = cur_focus->findRootMostFocusRoot();
@@ -2837,6 +2954,14 @@ void LLViewerWindow::updateKeyboardFocus()
}
parent = parent->getParentUICtrl();
}
+
+ // if we didn't find a better place to put focus, just release it
+ // hasFocus() will return true if and only if we didn't touch focus since we
+ // are only moving focus higher in the hierarchy
+ if (cur_focus->hasFocus())
+ {
+ cur_focus->setFocus(FALSE);
+ }
}
else if (cur_focus->isFocusRoot())
{
@@ -2880,44 +3005,49 @@ void LLViewerWindow::updateKeyboardFocus()
if(LLSideTray::instanceCreated())//just getInstance will create sidetray. we don't want this
LLSideTray::getInstance()->highlightFocused();
-
+}
- if (gSavedSettings.getBOOL("ChatBarStealsFocus")
- && gChatBar
- && gFocusMgr.getKeyboardFocus() == NULL
- && gChatBar->isInVisibleChain())
- {
- gChatBar->startChat(NULL);
- }
+static LLFastTimer::DeclareTimer FTM_UPDATE_WORLD_VIEW("Update World View");
+void LLViewerWindow::updateWorldViewRect(bool use_full_window)
+{
+ LLFastTimer ft(FTM_UPDATE_WORLD_VIEW);
+ // start off using whole window to render world
+ LLRect new_world_rect = mWindowRectRaw;
-}
+ if (use_full_window == false && mWorldViewPlaceholder.get())
+ {
+ 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);
-void LLViewerWindow::updateWorldViewRect()
-{
- if (!LLSideTray::instanceCreated()) return;
+ new_world_rect.mLeft = llround((F32)new_world_rect.mLeft * mDisplayScale.mV[VX]);
+ new_world_rect.mRight = llround((F32)new_world_rect.mRight * mDisplayScale.mV[VX]);
+ new_world_rect.mBottom = llround((F32)new_world_rect.mBottom * mDisplayScale.mV[VY]);
+ new_world_rect.mTop = llround((F32)new_world_rect.mTop * mDisplayScale.mV[VY]);
+ }
- LLRect new_world_rect = mWindowRect;
- LLSideTray* sidetray = LLSideTray::getInstance();
- if (sidetray->getVisible())
+ if (gSavedSettings.getBOOL("SidebarCameraMovement") == FALSE)
{
- new_world_rect.mRight -= llround((F32)sidetray->getTrayWidth() * mDisplayScale.mV[VX]);
+ // use right edge of window, ignoring sidebar
+ new_world_rect.mRight = mWindowRectRaw.mRight;
}
- if (mWorldViewRect != new_world_rect)
+
+ if (mWorldViewRectRaw != new_world_rect)
{
- mWorldViewRect = new_world_rect;
+ mWorldViewRectRaw = new_world_rect;
gResizeScreenTexture = TRUE;
- LLViewerCamera::getInstance()->setViewHeightInPixels( mWorldViewRect.getHeight() );
+ LLViewerCamera::getInstance()->setViewHeightInPixels( mWorldViewRectRaw.getHeight() );
LLViewerCamera::getInstance()->setAspect( getWorldViewAspectRatio() );
- }
-}
-/* static */
-void LLViewerWindow::hoverPickCallback(const LLPickInfo& pick_info)
-{
- gViewerWindow->mHoverPick = pick_info;
+ LLRect old_world_rect_scaled = mWorldViewRectScaled;
+ mWorldViewRectScaled = calcScaledRect(mWorldViewRectRaw, mDisplayScale);
+
+ // sending a signal with a new WorldView rect
+ mOnWorldViewRectUpdated(old_world_rect_scaled, mWorldViewRectScaled);
+ }
}
-
void LLViewerWindow::saveLastMouse(const LLCoordGL &point)
{
@@ -2927,9 +3057,9 @@ void LLViewerWindow::saveLastMouse(const LLCoordGL &point)
{
mCurrentMousePoint.mX = 0;
}
- else if (point.mX > getWindowWidth())
+ else if (point.mX > getWindowWidthScaled())
{
- mCurrentMousePoint.mX = getWindowWidth();
+ mCurrentMousePoint.mX = getWindowWidthScaled();
}
else
{
@@ -2940,9 +3070,9 @@ void LLViewerWindow::saveLastMouse(const LLCoordGL &point)
{
mCurrentMousePoint.mY = 0;
}
- else if (point.mY > getWindowHeight() )
+ else if (point.mY > getWindowHeightScaled() )
{
- mCurrentMousePoint.mY = getWindowHeight();
+ mCurrentMousePoint.mY = getWindowHeightScaled();
}
else
{
@@ -2955,7 +3085,6 @@ void LLViewerWindow::saveLastMouse(const LLCoordGL &point)
// Must be called after displayObjects is called, which sets the mGLName parameter
// NOTE: This function gets called 3 times:
// render_ui_3d: FALSE, FALSE, TRUE
-// renderObjectsForSelect: TRUE, pick_parcel_wall, FALSE
// render_hud_elements: FALSE, FALSE, FALSE
void LLViewerWindow::renderSelections( BOOL for_gl_pick, BOOL pick_parcel_walls, BOOL for_hud )
{
@@ -2985,7 +3114,7 @@ void LLViewerWindow::renderSelections( BOOL for_gl_pick, BOOL pick_parcel_walls,
// setup HUD render
if (selection->getSelectType() == SELECT_TYPE_HUD && LLSelectMgr::getInstance()->getSelection()->getObjectCount())
{
- LLBBox hud_bbox = gAgent.getAvatarObject()->getHUDBBox();
+ LLBBox hud_bbox = gAgentAvatarp->getHUDBBox();
// set up transform to encompass bounding box of HUD
glMatrixMode(GL_PROJECTION);
@@ -3012,7 +3141,7 @@ void LLViewerWindow::renderSelections( BOOL for_gl_pick, BOOL pick_parcel_walls,
glPushMatrix();
if (selection->getSelectType() == SELECT_TYPE_HUD)
{
- F32 zoom = gAgent.mHUDCurZoom;
+ F32 zoom = gAgentCamera.mHUDCurZoom;
glScalef(zoom, zoom, zoom);
}
@@ -3131,7 +3260,7 @@ LLVector3d LLViewerWindow::clickPointInWorldGlobal(S32 x, S32 y_from_bot, LLView
// world at the location of the mouse click
LLVector3 mouse_direction_global = mouseDirectionGlobal( x, y_from_bot );
- LLVector3d relative_object = clicked_object->getPositionGlobal() - gAgent.getCameraPositionGlobal();
+ LLVector3d relative_object = clicked_object->getPositionGlobal() - gAgentCamera.getCameraPositionGlobal();
// make mouse vector as long as object vector, so it touchs a point near
// where the user clicked on the object
@@ -3140,7 +3269,7 @@ LLVector3d LLViewerWindow::clickPointInWorldGlobal(S32 x, S32 y_from_bot, LLView
LLVector3d new_pos;
new_pos.setVec(mouse_direction_global);
// transform mouse vector back to world coords
- new_pos += gAgent.getCameraPositionGlobal();
+ new_pos += gAgentCamera.getCameraPositionGlobal();
return new_pos;
}
@@ -3164,14 +3293,13 @@ BOOL LLViewerWindow::clickPointOnSurfaceGlobal(const S32 x, const S32 y, LLViewe
return intersect;
}
-void LLViewerWindow::pickAsync(S32 x, S32 y_from_bot, MASK mask, void (*callback)(const LLPickInfo& info), BOOL pick_transparent, BOOL get_surface_info)
+void LLViewerWindow::pickAsync(S32 x, S32 y_from_bot, MASK mask, void (*callback)(const LLPickInfo& info), BOOL pick_transparent)
{
if (gNoRender)
{
return;
}
- // push back pick info object
BOOL in_build_mode = LLFloaterReg::instanceVisible("build");
if (in_build_mode || LLDrawPoolAlpha::sShowDebugAlpha)
{
@@ -3180,27 +3308,8 @@ void LLViewerWindow::pickAsync(S32 x, S32 y_from_bot, MASK mask, void (*callback
pick_transparent = TRUE;
}
- // center initial pick frame buffer region under mouse cursor
- // since that area is guaranteed to be onscreen and hence a valid
- // part of the framebuffer
- if (mPicks.empty())
- {
- mPickScreenRegion.setCenterAndSize(x, y_from_bot, PICK_DIAMETER, PICK_DIAMETER);
-
- if (mPickScreenRegion.mLeft < mWorldViewRect.mLeft) mPickScreenRegion.translate(mWorldViewRect.mLeft - mPickScreenRegion.mLeft, 0);
- if (mPickScreenRegion.mBottom < mWorldViewRect.mBottom) mPickScreenRegion.translate(0, mWorldViewRect.mBottom - mPickScreenRegion.mBottom);
- if (mPickScreenRegion.mRight > mWorldViewRect.mRight ) mPickScreenRegion.translate(mWorldViewRect.mRight - mPickScreenRegion.mRight, 0);
- if (mPickScreenRegion.mTop > mWorldViewRect.mTop ) mPickScreenRegion.translate(0, mWorldViewRect.mTop - mPickScreenRegion.mTop);
- }
-
- // set frame buffer region for picking results
- // stack multiple picks left to right
- LLRect screen_region = mPickScreenRegion;
- screen_region.translate(mPicks.size() * PICK_DIAMETER, 0);
-
- LLPickInfo pick(LLCoordGL(x, y_from_bot), screen_region, mask, pick_transparent, get_surface_info, callback);
-
- schedulePick(pick);
+ LLPickInfo pick_info(LLCoordGL(x, y_from_bot), mask, pick_transparent, TRUE, callback);
+ schedulePick(pick_info);
}
void LLViewerWindow::schedulePick(LLPickInfo& pick_info)
@@ -3215,10 +3324,11 @@ void LLViewerWindow::schedulePick(LLPickInfo& pick_info)
return;
}
- llassert_always(pick_info.mScreenRegion.notNull());
mPicks.push_back(pick_info);
// delay further event processing until we receive results of pick
+ // only do this for async picks so that handleMouseUp won't be called
+ // until the pick triggered in handleMouseDown has been processed, for example
mWindow->delayInputProcessing();
}
@@ -3266,11 +3376,17 @@ LLPickInfo LLViewerWindow::pickImmediate(S32 x, S32 y_from_bot, BOOL pick_trans
return LLPickInfo();
}
- pickAsync(x, y_from_bot, gKeyboard->currentMask(TRUE), NULL, pick_transparent);
- // assume that pickAsync put the results in the back of the mPicks list
- mLastPick = mPicks.back();
+ BOOL in_build_mode = LLFloaterReg::instanceVisible("build");
+ if (in_build_mode || LLDrawPoolAlpha::sShowDebugAlpha)
+ {
+ // build mode allows interaction with all transparent objects
+ // "Show Debug Alpha" means no object actually transparent
+ pick_transparent = TRUE;
+ }
+
+ // shortcut queueing in mPicks and just update mLastPick in place
+ mLastPick = LLPickInfo(LLCoordGL(x, y_from_bot), gKeyboard->currentMask(TRUE), pick_transparent, TRUE, NULL);
mLastPick.fetchResults();
- mPicks.pop_back();
return mLastPick;
}
@@ -3386,12 +3502,12 @@ LLVector3 LLViewerWindow::mouseDirectionGlobal(const S32 x, const S32 y) const
// find vertical field of view
F32 fov = LLViewerCamera::getInstance()->getView();
- // find world view center
- F32 center_x = (F32)getWorldViewRect().getCenterX();
- F32 center_y = (F32)getWorldViewRect().getCenterY();
+ // find world view center in scaled ui coordinates
+ F32 center_x = getWorldViewRectScaled().getCenterX();
+ F32 center_y = getWorldViewRectScaled().getCenterY();
// calculate pixel distance to screen
- F32 distance = (getWorldViewHeight() / 2.f) / (tan(fov / 2.f));
+ F32 distance = ((F32)getWorldViewHeightScaled() * 0.5f) / (tan(fov / 2.f));
// calculate click point relative to middle of screen
F32 click_x = x - center_x;
@@ -3410,17 +3526,17 @@ LLVector3 LLViewerWindow::mouseDirectionGlobal(const S32 x, const S32 y) const
LLVector3 LLViewerWindow::mousePointHUD(const S32 x, const S32 y) const
{
// find screen resolution
- S32 height = getWorldViewHeight();
+ S32 height = getWorldViewHeightScaled();
// find world view center
- F32 center_x = (F32)getWorldViewRect().getCenterX();
- F32 center_y = (F32)getWorldViewRect().getCenterY();
+ F32 center_x = getWorldViewRectScaled().getCenterX();
+ F32 center_y = 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;
F32 hud_y = ((F32)y - center_y) / height;
- return LLVector3(0.f, hud_x/gAgent.mHUDCurZoom, hud_y/gAgent.mHUDCurZoom);
+ return LLVector3(0.f, hud_x/gAgentCamera.mHUDCurZoom, hud_y/gAgentCamera.mHUDCurZoom);
}
// Returns unit vector relative to camera in camera space
@@ -3432,12 +3548,12 @@ LLVector3 LLViewerWindow::mouseDirectionCamera(const S32 x, const S32 y) const
F32 fov_width = fov_height * LLViewerCamera::getInstance()->getAspect();
// find screen resolution
- S32 height = getWorldViewHeight();
- S32 width = getWorldViewWidth();
+ S32 height = getWorldViewHeightScaled();
+ S32 width = getWorldViewWidthScaled();
// find world view center
- F32 center_x = (F32)getWorldViewRect().getCenterX();
- F32 center_y = (F32)getWorldViewRect().getCenterY();
+ F32 center_x = getWorldViewRectScaled().getCenterX();
+ F32 center_y = getWorldViewRectScaled().getCenterY();
// calculate click point relative to middle of screen
F32 click_x = (((F32)x - center_x) / (F32)width) * fov_width * -1.f;
@@ -3467,7 +3583,7 @@ BOOL LLViewerWindow::mousePointOnPlaneGlobal(LLVector3d& point, const S32 x, con
LLVector3d plane_normal_global_d;
plane_normal_global_d.setVec(plane_normal_global);
F64 plane_mouse_dot = (plane_normal_global_d * mouse_direction_global_d);
- LLVector3d plane_origin_camera_rel = plane_point_global - gAgent.getCameraPositionGlobal();
+ LLVector3d plane_origin_camera_rel = plane_point_global - gAgentCamera.getCameraPositionGlobal();
F64 mouse_look_at_scale = (plane_normal_global_d * plane_origin_camera_rel)
/ plane_mouse_dot;
if (llabs(plane_mouse_dot) < 0.00001)
@@ -3481,7 +3597,7 @@ BOOL LLViewerWindow::mousePointOnPlaneGlobal(LLVector3d& point, const S32 x, con
mouse_look_at_scale = plane_origin_camera_rel.magVec() / (plane_origin_dir * mouse_direction_global_d);
}
- point = gAgent.getCameraPositionGlobal() + mouse_look_at_scale * mouse_direction_global_d;
+ point = gAgentCamera.getCameraPositionGlobal() + mouse_look_at_scale * mouse_direction_global_d;
return mouse_look_at_scale > 0.0;
}
@@ -3499,12 +3615,12 @@ BOOL LLViewerWindow::mousePointOnLandGlobal(const S32 x, const S32 y, LLVector3d
const F32 SECOND_PASS_STEP = 0.1f; // meters
LLVector3d camera_pos_global;
- camera_pos_global = gAgent.getCameraPositionGlobal();
+ camera_pos_global = gAgentCamera.getCameraPositionGlobal();
LLVector3d probe_point_global;
LLVector3 probe_point_region;
// walk forwards to find the point
- for (mouse_dir_scale = FIRST_PASS_STEP; mouse_dir_scale < gAgent.mDrawDistance; mouse_dir_scale += FIRST_PASS_STEP)
+ for (mouse_dir_scale = FIRST_PASS_STEP; mouse_dir_scale < gAgentCamera.mDrawDistance; mouse_dir_scale += FIRST_PASS_STEP)
{
LLVector3d mouse_direction_global_d;
mouse_direction_global_d.setVec(mouse_direction_global * mouse_dir_scale);
@@ -3677,24 +3793,13 @@ void LLViewerWindow::movieSize(S32 new_width, S32 new_height)
||(size.mY != new_height + BORDERHEIGHT))
{
// use actual display dimensions, not virtual UI dimensions
- S32 x = gViewerWindow->getWindowDisplayWidth();
- S32 y = gViewerWindow->getWindowDisplayHeight();
+ S32 x = gViewerWindow->getWindowWidthRaw();
+ S32 y = gViewerWindow->getWindowHeightRaw();
BORDERWIDTH = size.mX - x;
BORDERHEIGHT = size.mY- y;
LLCoordScreen new_size(new_width + BORDERWIDTH,
new_height + BORDERHEIGHT);
- BOOL disable_sync = gSavedSettings.getBOOL("DisableVerticalSync");
- if (gViewerWindow->mWindow->getFullscreen())
- {
- gViewerWindow->changeDisplaySettings(FALSE,
- new_size,
- disable_sync,
- TRUE);
- }
- else
- {
- gViewerWindow->mWindow->setSize(new_size);
- }
+ gViewerWindow->mWindow->setSize(new_size);
}
}
@@ -3740,140 +3845,6 @@ void LLViewerWindow::playSnapshotAnimAndSound()
BOOL LLViewerWindow::thumbnailSnapshot(LLImageRaw *raw, S32 preview_width, S32 preview_height, BOOL show_ui, BOOL do_rebuild, ESnapshotType type)
{
return rawSnapshot(raw, preview_width, preview_height, FALSE, FALSE, show_ui, do_rebuild, type);
-
- // *TODO below code was broken in deferred pipeline
- /*
- if ((!raw) || preview_width < 10 || preview_height < 10)
- {
- return FALSE;
- }
-
- if(gResizeScreenTexture) //the window is resizing
- {
- return FALSE ;
- }
-
- setCursor(UI_CURSOR_WAIT);
-
- // Hide all the UI widgets first and draw a frame
- BOOL prev_draw_ui = gPipeline.hasRenderDebugFeatureMask(LLPipeline::RENDER_DEBUG_FEATURE_UI);
-
- if ( prev_draw_ui != show_ui)
- {
- LLPipeline::toggleRenderDebugFeature((void*)LLPipeline::RENDER_DEBUG_FEATURE_UI);
- }
-
- BOOL hide_hud = !gSavedSettings.getBOOL("RenderHUDInSnapshot") && LLPipeline::sShowHUDAttachments;
- if (hide_hud)
- {
- LLPipeline::sShowHUDAttachments = FALSE;
- }
-
- S32 render_name = gSavedSettings.getS32("RenderName");
- gSavedSettings.setS32("RenderName", 0);
- LLVOAvatar::updateFreezeCounter(1) ; //pause avatar updating for one frame
-
- S32 w = preview_width ;
- S32 h = preview_height ;
- LLVector2 display_scale = mDisplayScale ;
- mDisplayScale.setVec((F32)w / mWindowRect.getWidth(), (F32)h / mWindowRect.getHeight()) ;
- LLRect window_rect = mWindowRect;
- mWindowRect.set(0, h, w, 0);
-
- gDisplaySwapBuffers = FALSE;
- gDepthDirty = TRUE;
- glClearColor(0.f, 0.f, 0.f, 0.f);
- glClear(GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);
- setup3DRender();
-
- LLFontGL::setFontDisplay(FALSE) ;
- LLHUDText::setDisplayText(FALSE) ;
- if (type == SNAPSHOT_TYPE_OBJECT_ID)
- {
- gObjectList.renderPickList(gViewerWindow->getVirtualWindowRect(), FALSE, FALSE);
- }
- else
- {
- display(do_rebuild, 1.0f, 0, TRUE);
- render_ui();
- }
-
- S32 glformat, gltype, glpixel_length ;
- if(SNAPSHOT_TYPE_DEPTH == type)
- {
- glpixel_length = 4 ;
- glformat = GL_DEPTH_COMPONENT ;
- gltype = GL_FLOAT ;
- }
- else
- {
- glpixel_length = 3 ;
- glformat = GL_RGB ;
- gltype = GL_UNSIGNED_BYTE ;
- }
-
- raw->resize(w, h, glpixel_length);
- glReadPixels(0, 0, w, h, glformat, gltype, raw->getData());
-
- if(SNAPSHOT_TYPE_DEPTH == type)
- {
- LLViewerCamera* camerap = LLViewerCamera::getInstance();
- F32 depth_conversion_factor_1 = (camerap->getFar() + camerap->getNear()) / (2.f * camerap->getFar() * camerap->getNear());
- F32 depth_conversion_factor_2 = (camerap->getFar() - camerap->getNear()) / (2.f * camerap->getFar() * camerap->getNear());
-
- //calculate the depth
- for (S32 y = 0 ; y < h ; y++)
- {
- for(S32 x = 0 ; x < w ; x++)
- {
- S32 i = (w * y + x) << 2 ;
-
- F32 depth_float_i = *(F32*)(raw->getData() + i);
-
- F32 linear_depth_float = 1.f / (depth_conversion_factor_1 - (depth_float_i * depth_conversion_factor_2));
- U8 depth_byte = F32_to_U8(linear_depth_float, camerap->getNear(), camerap->getFar());
- *(raw->getData() + i + 0) = depth_byte;
- *(raw->getData() + i + 1) = depth_byte;
- *(raw->getData() + i + 2) = depth_byte;
- *(raw->getData() + i + 3) = 255;
- }
- }
- }
-
- LLFontGL::setFontDisplay(TRUE) ;
- LLHUDText::setDisplayText(TRUE) ;
- mDisplayScale.setVec(display_scale) ;
- mWindowRect = window_rect;
- setup3DRender();
- gDisplaySwapBuffers = FALSE;
- gDepthDirty = TRUE;
-
- // POST SNAPSHOT
- if (!gPipeline.hasRenderDebugFeatureMask(LLPipeline::RENDER_DEBUG_FEATURE_UI))
- {
- LLPipeline::toggleRenderDebugFeature((void*)LLPipeline::RENDER_DEBUG_FEATURE_UI);
- }
-
- if (hide_hud)
- {
- LLPipeline::sShowHUDAttachments = TRUE;
- }
-
- setCursor(UI_CURSOR_ARROW);
-
- if (do_rebuild)
- {
- // If we had to do a rebuild, that means that the lists of drawables to be rendered
- // was empty before we started.
- // Need to reset these, otherwise we call state sort on it again when render gets called the next time
- // and we stand a good chance of crashing on rebuild because the render drawable arrays have multiple copies of
- // objects on them.
- gPipeline.resetDrawOrders();
- }
-
- gSavedSettings.setS32("RenderName", render_name);
-
- return TRUE;*/
}
// Saves the image from the screen to the specified filename and path.
@@ -3908,12 +3879,12 @@ BOOL LLViewerWindow::rawSnapshot(LLImageRaw *raw, S32 image_width, S32 image_hei
// Copy screen to a buffer
// crop sides or top and bottom, if taking a snapshot of different aspect ratio
// from window
- S32 snapshot_width = mWindowRect.getWidth();
- S32 snapshot_height = mWindowRect.getHeight();
+ S32 snapshot_width = mWindowRectRaw.getWidth();
+ S32 snapshot_height = mWindowRectRaw.getHeight();
// SNAPSHOT
- S32 window_width = mWindowRect.getWidth();
- S32 window_height = mWindowRect.getHeight();
- LLRect window_rect = mWindowRect;
+ S32 window_width = mWindowRectRaw.getWidth();
+ S32 window_height = mWindowRectRaw.getHeight();
+ LLRect window_rect = mWindowRectRaw;
BOOL use_fbo = FALSE;
LLRenderTarget target;
@@ -3929,7 +3900,7 @@ BOOL LLViewerWindow::rawSnapshot(LLImageRaw *raw, S32 image_width, S32 image_hei
{
if(image_width > window_width || image_height > window_height) //need to enlarge the scene
{
- if (gGLManager.mHasFramebufferObject && !show_ui)
+ if (!LLPipeline::sRenderDeferred && gGLManager.mHasFramebufferObject && !show_ui)
{
GLint max_size = 0;
glGetIntegerv(GL_MAX_RENDERBUFFER_SIZE_EXT, &max_size);
@@ -3944,7 +3915,7 @@ BOOL LLViewerWindow::rawSnapshot(LLImageRaw *raw, S32 image_width, S32 image_hei
window_width = snapshot_width;
window_height = snapshot_height;
scale_factor = 1.f;
- mWindowRect.set(0, snapshot_height, snapshot_width, 0);
+ mWindowRectRaw.set(0, snapshot_height, snapshot_width, 0);
target.bindTarget();
}
}
@@ -3960,6 +3931,9 @@ BOOL LLViewerWindow::rawSnapshot(LLImageRaw *raw, S32 image_width, S32 image_hei
//else: keep the current scene scale, re-scale it if necessary after reading out.
}
+ // if not showing ui, use full window to render world view
+ updateWorldViewRect(!show_ui);
+
S32 buffer_x_offset = llfloor(((window_width - snapshot_width) * scale_factor) / 2.f);
S32 buffer_y_offset = llfloor(((window_height - snapshot_height) * scale_factor) / 2.f);
@@ -3971,13 +3945,20 @@ BOOL LLViewerWindow::rawSnapshot(LLImageRaw *raw, S32 image_width, S32 image_hei
image_buffer_x = llfloor(snapshot_width*scale_factor) ;
image_buffer_y = llfloor(snapshot_height *scale_factor) ;
}
+ if(image_buffer_x > 0 && image_buffer_y > 0)
+ {
raw->resize(image_buffer_x, image_buffer_y, 3);
+ }
+ else
+ {
+ return FALSE ;
+ }
if(raw->isBufferInvalid())
{
return FALSE ;
}
- BOOL high_res = scale_factor > 1.f;
+ BOOL high_res = scale_factor >= 2.f; // Font scaling is slow, only do so if rez is much higher
if (high_res)
{
send_agent_pause();
@@ -4012,14 +3993,22 @@ BOOL LLViewerWindow::rawSnapshot(LLImageRaw *raw, S32 image_width, S32 image_hei
LLViewerCamera::getInstance()->setZoomParameters(scale_factor, subimage_x+(subimage_y*llceil(scale_factor)));
setup3DRender();
- gObjectList.renderPickList(gViewerWindow->getVirtualWindowRect(), FALSE, FALSE);
+ gObjectList.renderPickList(gViewerWindow->getWindowRectScaled(), FALSE, FALSE);
}
else
{
const U32 subfield = subimage_x+(subimage_y*llceil(scale_factor));
- display(do_rebuild, scale_factor, subfield, TRUE);
- // Required for showing the GUI in snapshots? See DEV-16350 for details. JC
- render_ui(scale_factor, subfield);
+
+ if (LLPipeline::sRenderDeferred)
+ {
+ display(do_rebuild, scale_factor, subfield, FALSE);
+ }
+ else
+ {
+ display(do_rebuild, scale_factor, subfield, TRUE);
+ // Required for showing the GUI in snapshots? See DEV-16350 for details. JC
+ render_ui(scale_factor, subfield);
+ }
}
S32 subimage_x_offset = llclamp(buffer_x_offset - (subimage_x * window_width), 0, window_width);
@@ -4083,7 +4072,7 @@ BOOL LLViewerWindow::rawSnapshot(LLImageRaw *raw, S32 image_width, S32 image_hei
if (use_fbo)
{
- mWindowRect = window_rect;
+ mWindowRectRaw = window_rect;
target.flush();
glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0);
}
@@ -4155,41 +4144,20 @@ void LLViewerWindow::destroyWindow()
void LLViewerWindow::drawMouselookInstructions()
{
- // Draw instructions for mouselook ("Press ESC to leave Mouselook" in a box at the top of the screen.)
+ // Draw instructions for mouselook ("Press ESC to return to World View" partially transparent at the bottom of the screen.)
const std::string instructions = LLTrans::getString("LeaveMouselook");
- const LLFontGL* font = LLFontGL::getFontSansSerif();
-
- const S32 INSTRUCTIONS_PAD = 5;
- LLRect instructions_rect;
- instructions_rect.setLeftTopAndSize(
- mWorldViewRect.mLeft + INSTRUCTIONS_PAD,
- mWorldViewRect.mTop - INSTRUCTIONS_PAD,
- font->getWidth( instructions ) + 2 * INSTRUCTIONS_PAD,
- llround(font->getLineHeight() + 2 * INSTRUCTIONS_PAD));
-
- {
- gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
- gGL.color4f( 0.9f, 0.9f, 0.9f, 1.0f );
- gl_rect_2d( instructions_rect );
- }
+ const LLFontGL* font = LLFontGL::getFont(LLFontDescriptor("SansSerif", "Large", LLFontGL::BOLD));
+ //to be on top of Bottom bar when it is opened
+ const S32 INSTRUCTIONS_PAD = 50;
+
font->renderUTF8(
instructions, 0,
- instructions_rect.mLeft + INSTRUCTIONS_PAD,
- instructions_rect.mTop - INSTRUCTIONS_PAD,
- LLColor4( 0.0f, 0.0f, 0.0f, 1.f ),
- LLFontGL::LEFT, LLFontGL::TOP);
-}
-
-
-S32 LLViewerWindow::getWindowHeight() const
-{
- return mVirtualWindowRect.getHeight();
-}
-
-S32 LLViewerWindow::getWindowWidth() const
-{
- return mVirtualWindowRect.getWidth();
+ getWorldViewRectScaled().getCenterX(),
+ getWorldViewRectScaled().mBottom + INSTRUCTIONS_PAD,
+ LLColor4( 1.0f, 1.0f, 1.0f, 0.5f ),
+ LLFontGL::HCENTER, LLFontGL::TOP,
+ LLFontGL::NORMAL,LLFontGL::DROP_SHADOW);
}
void* LLViewerWindow::getPlatformWindow() const
@@ -4212,49 +4180,65 @@ LLRootView* LLViewerWindow::getRootView() const
return mRootView;
}
-LLRect LLViewerWindow::getVirtualWorldViewRect() const
+LLRect LLViewerWindow::getWorldViewRectScaled() const
+{
+ return mWorldViewRectScaled;
+}
+
+S32 LLViewerWindow::getWorldViewHeightScaled() const
{
- LLRect world_view_rect = mWorldViewRect;
- world_view_rect.mLeft = llround((F32)world_view_rect.mLeft / mDisplayScale.mV[VX]);
- world_view_rect.mRight = llround((F32)world_view_rect.mRight / mDisplayScale.mV[VX]);
- world_view_rect.mBottom = llround((F32)world_view_rect.mBottom / mDisplayScale.mV[VY]);
- world_view_rect.mTop = llround((F32)world_view_rect.mTop / mDisplayScale.mV[VY]);
- return world_view_rect;
+ return mWorldViewRectScaled.getHeight();
}
-S32 LLViewerWindow::getWorldViewHeight() const
+S32 LLViewerWindow::getWorldViewWidthScaled() const
{
- return mWorldViewRect.getHeight();
+ return mWorldViewRectScaled.getWidth();
}
-S32 LLViewerWindow::getWorldViewWidth() const
+
+S32 LLViewerWindow::getWorldViewHeightRaw() const
+{
+ return mWorldViewRectRaw.getHeight();
+}
+
+S32 LLViewerWindow::getWorldViewWidthRaw() const
{
- return mWorldViewRect.getWidth();
+ return mWorldViewRectRaw.getWidth();
+}
+
+S32 LLViewerWindow::getWindowHeightScaled() const
+{
+ return mWindowRectScaled.getHeight();
}
-S32 LLViewerWindow::getWindowDisplayHeight() const
+S32 LLViewerWindow::getWindowWidthScaled() const
{
- return mWindowRect.getHeight();
+ return mWindowRectScaled.getWidth();
}
-S32 LLViewerWindow::getWindowDisplayWidth() const
+S32 LLViewerWindow::getWindowHeightRaw() const
{
- return mWindowRect.getWidth();
+ return mWindowRectRaw.getHeight();
+}
+
+S32 LLViewerWindow::getWindowWidthRaw() const
+{
+ return mWindowRectRaw.getWidth();
}
void LLViewerWindow::setup2DRender()
{
// setup ortho camera
- gl_state_for_2d(mWindowRect.getWidth(), mWindowRect.getHeight());
+ gl_state_for_2d(mWindowRectRaw.getWidth(), mWindowRectRaw.getHeight());
setup2DViewport();
}
void LLViewerWindow::setup2DViewport(S32 x_offset, S32 y_offset)
{
- gGLViewport[0] = mWindowRect.mLeft + x_offset;
- gGLViewport[1] = mWindowRect.mBottom + y_offset;
- gGLViewport[2] = mWindowRect.getWidth();
- gGLViewport[3] = mWindowRect.getHeight();
+ gGLViewport[0] = mWindowRectRaw.mLeft + x_offset;
+ gGLViewport[1] = mWindowRectRaw.mBottom + y_offset;
+ gGLViewport[2] = mWindowRectRaw.getWidth();
+ gGLViewport[3] = mWindowRectRaw.getHeight();
glViewport(gGLViewport[0], gGLViewport[1], gGLViewport[2], gGLViewport[3]);
}
@@ -4262,7 +4246,7 @@ void LLViewerWindow::setup2DViewport(S32 x_offset, S32 y_offset)
void LLViewerWindow::setup3DRender()
{
// setup perspective camera
- LLViewerCamera::getInstance()->setPerspective(NOT_FOR_SELECTION, mWorldViewRect.mLeft, mWorldViewRect.mBottom, mWorldViewRect.getWidth(), mWorldViewRect.getHeight(), FALSE, LLViewerCamera::getInstance()->getNear(), MAX_FAR_CLIP*2.f);
+ LLViewerCamera::getInstance()->setPerspective(NOT_FOR_SELECTION, mWorldViewRectRaw.mLeft, mWorldViewRectRaw.mBottom, mWorldViewRectRaw.getWidth(), mWorldViewRectRaw.getHeight(), FALSE, LLViewerCamera::getInstance()->getNear(), MAX_FAR_CLIP*2.f);
setup3DViewport();
}
@@ -4270,17 +4254,17 @@ void LLViewerWindow::setup3DViewport(S32 x_offset, S32 y_offset)
{
if (LLRenderTarget::getCurrentBoundTarget() != NULL)
{
- // don't use translation component of mWorldViewRect, as we are already in a properly sized render target
+ // don't use translation component of mWorldViewRectRaw, as we are already in a properly sized render target
gGLViewport[0] = x_offset;
gGLViewport[1] = y_offset;
}
else
{
- gGLViewport[0] = mWorldViewRect.mLeft + x_offset;
- gGLViewport[1] = mWorldViewRect.mBottom + y_offset;
+ gGLViewport[0] = mWorldViewRectRaw.mLeft + x_offset;
+ gGLViewport[1] = mWorldViewRectRaw.mBottom + y_offset;
}
- gGLViewport[2] = mWorldViewRect.getWidth();
- gGLViewport[3] = mWorldViewRect.getHeight();
+ gGLViewport[2] = mWorldViewRectRaw.getWidth();
+ gGLViewport[3] = mWorldViewRectRaw.getHeight();
glViewport(gGLViewport[0], gGLViewport[1], gGLViewport[2], gGLViewport[3]);
}
@@ -4297,20 +4281,6 @@ BOOL LLViewerWindow::getShowProgress() const
return (mProgressView && mProgressView->getVisible());
}
-void LLViewerWindow::handleLoginComplete()
-{
- LLNavigationBar::getInstance()->handleLoginComplete();
-}
-
-void LLViewerWindow::moveProgressViewToFront()
-{
- if( mProgressView && mRootView )
- {
- mRootView->removeChild( mProgressView );
- mRootView->addChild( mProgressView );
- }
-}
-
void LLViewerWindow::setProgressString(const std::string& string)
{
if (mProgressView)
@@ -4362,7 +4332,7 @@ void LLViewerWindow::stopGL(BOOL save_state)
//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.
- //especially be careful to put anything behind gImageList.destroyGL(save_state);
+ //especially be careful to put anything behind gTextureList.destroyGL(save_state);
if (!gGLManager.mIsDisabled)
{
llinfos << "Shutting down GL..." << llendl;
@@ -4387,7 +4357,7 @@ void LLViewerWindow::stopGL(BOOL save_state)
LLVOAvatar::destroyGL();
stop_glerror();
- LLDynamicTexture::destroyGL();
+ LLViewerDynamicTexture::destroyGL();
stop_glerror();
if (gPipeline.isInit())
@@ -4405,9 +4375,9 @@ void LLViewerWindow::stopGL(BOOL save_state)
gPostProcess->invalidate();
}
- gImageList.destroyGL(save_state);
+ gTextureList.destroyGL(save_state);
stop_glerror();
-
+
gGLManager.mIsDisabled = TRUE;
stop_glerror();
@@ -4420,7 +4390,7 @@ void LLViewerWindow::restoreGL(const std::string& progress_message)
//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.
- //especially, be careful to put something before gImageList.restoreGL();
+ //especially, be careful to put something before gTextureList.restoreGL();
if (gGLManager.mIsDisabled)
{
llinfos << "Restoring GL..." << llendl;
@@ -4428,8 +4398,9 @@ void LLViewerWindow::restoreGL(const std::string& progress_message)
initGLDefaults();
LLGLState::restoreGL();
- gImageList.restoreGL();
-
+
+ gTextureList.restoreGL();
+
// for future support of non-square pixels, and fonts that are properly stretched
//LLFontGL::destroyDefaultFonts();
initFonts();
@@ -4440,12 +4411,12 @@ void LLViewerWindow::restoreGL(const std::string& progress_message)
LLManipTranslate::restoreGL();
gBumpImageList.restoreGL();
- LLDynamicTexture::restoreGL();
+ LLViewerDynamicTexture::restoreGL();
LLVOAvatar::restoreGL();
gResizeScreenTexture = TRUE;
- if (gFloaterCustomize && gFloaterCustomize->getVisible())
+ if (isAgentAvatarValid() && !gAgentAvatarp->isUsingBakedTextures())
{
LLVisualParamHint::requestHintUpdates();
}
@@ -4479,51 +4450,12 @@ void LLViewerWindow::initFonts(F32 zoom_factor)
LLFontGL::loadDefaultFonts();
}
-void LLViewerWindow::toggleFullscreen(BOOL show_progress)
-{
- if (mWindow)
- {
- mWantFullscreen = mWindow->getFullscreen() ? FALSE : TRUE;
- mIsFullscreenChecked = mWindow->getFullscreen() ? FALSE : TRUE;
- mShowFullscreenProgress = show_progress;
- }
-}
-
-void LLViewerWindow::getTargetWindow(BOOL& fullscreen, S32& width, S32& height) const
-{
- fullscreen = mWantFullscreen;
-
- if (mWindow
- && mWindow->getFullscreen() == mWantFullscreen)
- {
- width = getWindowDisplayWidth();
- height = getWindowDisplayHeight();
- }
- else if (mWantFullscreen)
- {
- width = gSavedSettings.getS32("FullScreenWidth");
- height = gSavedSettings.getS32("FullScreenHeight");
- }
- else
- {
- width = gSavedSettings.getS32("WindowWidth");
- height = gSavedSettings.getS32("WindowHeight");
- }
-}
-
void LLViewerWindow::requestResolutionUpdate()
{
mResDirty = true;
}
-void LLViewerWindow::requestResolutionUpdate(bool fullscreen_checked)
-{
- mResDirty = true;
- mWantFullscreen = fullscreen_checked;
- mIsFullscreenChecked = fullscreen_checked;
-}
-
-BOOL LLViewerWindow::checkSettings()
+void LLViewerWindow::checkSettings()
{
if (mStatesDirty)
{
@@ -4535,70 +4467,9 @@ BOOL LLViewerWindow::checkSettings()
// We want to update the resolution AFTER the states getting refreshed not before.
if (mResDirty)
{
- if (gSavedSettings.getBOOL("FullScreenAutoDetectAspectRatio"))
- {
- getWindow()->setNativeAspectRatio(0.f);
- }
- else
- {
- getWindow()->setNativeAspectRatio(gSavedSettings.getF32("FullScreenAspectRatio"));
- }
-
- reshape(getWindowDisplayWidth(), getWindowDisplayHeight());
-
- // force aspect ratio
- if (mIsFullscreenChecked)
- {
- LLViewerCamera::getInstance()->setAspect( getWorldViewAspectRatio() );
- }
-
+ reshape(getWindowWidthRaw(), getWindowHeightRaw());
mResDirty = false;
- }
-
- BOOL is_fullscreen = mWindow->getFullscreen();
- if(mWantFullscreen)
- {
- LLCoordScreen screen_size;
- LLCoordScreen desired_screen_size(gSavedSettings.getS32("FullScreenWidth"),
- gSavedSettings.getS32("FullScreenHeight"));
- getWindow()->getSize(&screen_size);
- if(!is_fullscreen ||
- screen_size.mX != desired_screen_size.mX
- || screen_size.mY != desired_screen_size.mY)
- {
- if (!LLStartUp::canGoFullscreen())
- {
- return FALSE;
- }
-
- LLGLState::checkStates();
- LLGLState::checkTextureChannels();
- changeDisplaySettings(TRUE,
- desired_screen_size,
- gSavedSettings.getBOOL("DisableVerticalSync"),
- mShowFullscreenProgress);
-
- LLGLState::checkStates();
- LLGLState::checkTextureChannels();
- mStatesDirty = true;
- return TRUE;
- }
- }
- else
- {
- if(is_fullscreen)
- {
- // Changing to windowed mode.
- changeDisplaySettings(FALSE,
- LLCoordScreen(gSavedSettings.getS32("WindowWidth"),
- gSavedSettings.getS32("WindowHeight")),
- TRUE,
- mShowFullscreenProgress);
- mStatesDirty = true;
- return TRUE;
- }
- }
- return FALSE;
+ }
}
void LLViewerWindow::restartDisplay(BOOL show_progress_bar)
@@ -4607,7 +4478,7 @@ void LLViewerWindow::restartDisplay(BOOL show_progress_bar)
stopGL();
if (show_progress_bar)
{
- restoreGL("Changing Resolution...");
+ restoreGL(LLTrans::getString("ProgressChangingResolution"));
}
else
{
@@ -4615,47 +4486,35 @@ void LLViewerWindow::restartDisplay(BOOL show_progress_bar)
}
}
-BOOL LLViewerWindow::changeDisplaySettings(BOOL fullscreen, LLCoordScreen size, BOOL disable_vsync, BOOL show_progress_bar)
+BOOL LLViewerWindow::changeDisplaySettings(LLCoordScreen size, BOOL disable_vsync, BOOL show_progress_bar)
{
- BOOL was_maximized = gSavedSettings.getBOOL("WindowMaximized");
- mWantFullscreen = fullscreen;
- mShowFullscreenProgress = show_progress_bar;
- gSavedSettings.setBOOL("NotFullScreen", !mWantFullscreen);
+ //BOOL was_maximized = gSavedSettings.getBOOL("WindowMaximized");
//gResizeScreenTexture = TRUE;
- BOOL old_fullscreen = mWindow->getFullscreen();
- if (!old_fullscreen && fullscreen && !LLStartUp::canGoFullscreen())
+ //U32 fsaa = gSavedSettings.getU32("RenderFSAASamples");
+ //U32 old_fsaa = mWindow->getFSAASamples();
+
+ // if not maximized, use the request size
+ if (!mWindow->getMaximized())
{
- // Not allowed to switch to fullscreen now, so exit early.
- // *NOTE: This case should never be reached, but just-in-case.
- return TRUE;
+ mWindow->setSize(size);
}
- U32 fsaa = gSavedSettings.getU32("RenderFSAASamples");
- U32 old_fsaa = mWindow->getFSAASamples();
- // going from windowed to windowed
- if (!old_fullscreen && !fullscreen)
+ //if (fsaa == old_fsaa)
{
- // if not maximized, use the request size
- if (!mWindow->getMaximized())
- {
- mWindow->setSize(size);
- }
-
- if (fsaa == old_fsaa)
- {
- return TRUE;
- }
+ return TRUE;
}
+/*
+
// Close floaters that don't handle settings change
LLFloaterReg::hideInstance("snapshot");
BOOL result_first_try = FALSE;
BOOL result_second_try = FALSE;
- LLUICtrl* keyboard_focus = gFocusMgr.getKeyboardFocus();
+ LLFocusableElement* keyboard_focus = gFocusMgr.getKeyboardFocus();
send_agent_pause();
llinfos << "Stopping GL during changeDisplaySettings" << llendl;
stopGL();
@@ -4663,23 +4522,15 @@ BOOL LLViewerWindow::changeDisplaySettings(BOOL fullscreen, LLCoordScreen size,
LLCoordScreen old_size;
LLCoordScreen old_pos;
mWindow->getSize(&old_size);
- BOOL got_position = mWindow->getPosition(&old_pos);
- if (!old_fullscreen && fullscreen && got_position)
- {
- // switching from windowed to fullscreen, so save window position
- gSavedSettings.setS32("WindowX", old_pos.mX);
- gSavedSettings.setS32("WindowY", old_pos.mY);
- }
-
- mWindow->setFSAASamples(fsaa);
+ //mWindow->setFSAASamples(fsaa);
- result_first_try = mWindow->switchContext(fullscreen, size, disable_vsync);
+ 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(old_fullscreen, old_size, disable_vsync);
+ //mWindow->setFSAASamples(old_fsaa);
+ result_second_try = mWindow->switchContext(false, old_size, disable_vsync);
if (!result_second_try)
{
@@ -4694,7 +4545,7 @@ BOOL LLViewerWindow::changeDisplaySettings(BOOL fullscreen, LLCoordScreen size,
llinfos << "Restoring GL during resolution change" << llendl;
if (show_progress_bar)
{
- restoreGL("Changing Resolution...");
+ restoreGL(LLTrans::getString("ProgressChangingResolution"));
}
else
{
@@ -4706,24 +4557,13 @@ BOOL LLViewerWindow::changeDisplaySettings(BOOL fullscreen, LLCoordScreen size,
LLSD args;
args["RESX"] = llformat("%d",size.mX);
args["RESY"] = llformat("%d",size.mY);
- LLNotifications::instance().add("ResolutionSwitchFail", args);
+ LLNotificationsUtil::add("ResolutionSwitchFail", args);
size = old_size; // for reshape below
}
BOOL success = result_first_try || result_second_try;
- if (success)
- {
-#if LL_WINDOWS
- // Only trigger a reshape after switching to fullscreen; otherwise rely on the windows callback
- // (otherwise size is wrong; this is the entire window size, reshape wants the visible window size)
- if (fullscreen && result_first_try)
-#endif
- {
- reshape(size.mX, size.mY);
- }
- }
- if (!mWindow->getFullscreen() && success)
+ if (success)
{
// maximize window if was maximized, else reposition
if (was_maximized)
@@ -4741,51 +4581,16 @@ BOOL LLViewerWindow::changeDisplaySettings(BOOL fullscreen, LLCoordScreen size,
mIgnoreActivate = FALSE;
gFocusMgr.setKeyboardFocus(keyboard_focus);
- mWantFullscreen = mWindow->getFullscreen();
- mShowFullscreenProgress = FALSE;
return success;
-}
-
-F32 LLViewerWindow::getDisplayAspectRatio() const
-{
- if (mWindow->getFullscreen())
- {
- if (gSavedSettings.getBOOL("FullScreenAutoDetectAspectRatio"))
- {
- return mWindow->getNativeAspectRatio();
- }
- else
- {
- return gSavedSettings.getF32("FullScreenAspectRatio");
- }
- }
- else
- {
- return mWindow->getNativeAspectRatio();
- }
+ */
}
-
F32 LLViewerWindow::getWorldViewAspectRatio() const
{
- F32 world_aspect = (F32)mWorldViewRect.getWidth() / (F32)mWorldViewRect.getHeight();
- //F32 window_aspect = (F32)mWindowRect.getWidth() / (F32)mWindowRect.getHeight();
- if (mWindow->getFullscreen())
- {
- return world_aspect * mWindow->getPixelAspectRatio();
- }
- else
- {
- llinfos << "World aspect ratio: " << world_aspect << llendl;
- return world_aspect;
- }
-}
-
-void LLViewerWindow::drawPickBuffer() const
-{
- mHoverPick.drawPickBuffer();
+ F32 world_aspect = (F32)mWorldViewRectRaw.getWidth() / (F32)mWorldViewRectRaw.getHeight();
+ return world_aspect;
}
void LLViewerWindow::calcDisplayScale()
@@ -4793,27 +4598,13 @@ void LLViewerWindow::calcDisplayScale()
F32 ui_scale_factor = gSavedSettings.getF32("UIScaleFactor");
LLVector2 display_scale;
display_scale.setVec(llmax(1.f / mWindow->getPixelAspectRatio(), 1.f), llmax(mWindow->getPixelAspectRatio(), 1.f));
- F32 height_normalization = gSavedSettings.getBOOL("UIAutoScale") ? ((F32)mWindowRect.getHeight() / display_scale.mV[VY]) / 768.f : 1.f;
- if(mWindow->getFullscreen())
- {
- display_scale *= (ui_scale_factor * height_normalization);
- }
- else
- {
- display_scale *= ui_scale_factor;
- }
+ display_scale *= ui_scale_factor;
// limit minimum display scale
if (display_scale.mV[VX] < MIN_DISPLAY_SCALE || display_scale.mV[VY] < MIN_DISPLAY_SCALE)
{
display_scale *= MIN_DISPLAY_SCALE / llmin(display_scale.mV[VX], display_scale.mV[VY]);
}
-
- if (mWindow->getFullscreen())
- {
- display_scale.mV[0] = llround(display_scale.mV[0], 2.0f/(F32) mWindowRect.getWidth());
- display_scale.mV[1] = llround(display_scale.mV[1], 2.0f/(F32) mWindowRect.getHeight());
- }
if (display_scale != mDisplayScale)
{
@@ -4825,20 +4616,31 @@ void LLViewerWindow::calcDisplayScale()
}
}
-S32 TOOL_BAR_HEIGHT = 20; // *TODO:Skinning Fix
+//static
+LLRect LLViewerWindow::calcScaledRect(const LLRect & rect, const LLVector2& display_scale)
+{
+ LLRect res = rect;
+ res.mLeft = llround((F32)res.mLeft / display_scale.mV[VX]);
+ res.mRight = llround((F32)res.mRight / display_scale.mV[VX]);
+ res.mBottom = llround((F32)res.mBottom / display_scale.mV[VY]);
+ res.mTop = llround((F32)res.mTop / display_scale.mV[VY]);
+
+ return res;
+}
S32 LLViewerWindow::getChatConsoleBottomPad()
{
S32 offset = 0;
- if( gToolBar && gToolBar->getVisible() )
- offset += TOOL_BAR_HEIGHT;
+
+ if(LLBottomTray::instanceExists())
+ offset += LLBottomTray::getInstance()->getRect().getHeight();
return offset;
}
LLRect LLViewerWindow::getChatConsoleRect()
{
- LLRect full_window(0, getWindowHeight(), getWindowWidth(), 0);
+ LLRect full_window(0, getWindowHeightScaled(), getWindowWidthScaled(), 0);
LLRect console_rect = full_window;
const S32 CONSOLE_PADDING_TOP = 24;
@@ -4850,7 +4652,9 @@ LLRect LLViewerWindow::getChatConsoleRect()
console_rect.mLeft += CONSOLE_PADDING_LEFT;
- if (gSavedSettings.getBOOL("ChatFullWidth"))
+ static const BOOL CHAT_FULL_WIDTH = gSavedSettings.getBOOL("ChatFullWidth");
+
+ if (CHAT_FULL_WIDTH)
{
console_rect.mRight -= CONSOLE_PADDING_RIGHT;
}
@@ -4858,7 +4662,7 @@ LLRect LLViewerWindow::getChatConsoleRect()
{
// Make console rect somewhat narrow so having inventory open is
// less of a problem.
- console_rect.mRight = console_rect.mLeft + 2 * getWindowWidth() / 3;
+ console_rect.mRight = console_rect.mLeft + 2 * getWindowWidthScaled() / 3;
}
return console_rect;
@@ -4881,9 +4685,9 @@ bool LLViewerWindow::onAlert(const LLSD& notify)
// If we're in mouselook, the mouse is hidden and so the user can't click
// the dialog buttons. In that case, change to First Person instead.
- if( gAgent.cameraMouselook() )
+ if( gAgentCamera.cameraMouselook() )
{
- gAgent.changeCameraToDefault();
+ gAgentCamera.changeCameraToDefault();
}
return false;
}
@@ -4910,13 +4714,11 @@ LLPickInfo::LLPickInfo()
}
LLPickInfo::LLPickInfo(const LLCoordGL& mouse_pos,
- const LLRect& screen_region,
- MASK keyboard_mask,
- BOOL pick_transparent,
- BOOL pick_uv_coords,
- void (*pick_callback)(const LLPickInfo& pick_info))
+ MASK keyboard_mask,
+ BOOL pick_transparent,
+ BOOL pick_uv_coords,
+ void (*pick_callback)(const LLPickInfo& pick_info))
: mMousePt(mouse_pos),
- mScreenRegion(screen_region),
mKeyMask(keyboard_mask),
mPickCallback(pick_callback),
mPickType(PICK_INVALID),
@@ -4932,10 +4734,6 @@ LLPickInfo::LLPickInfo(const LLCoordGL& mouse_pos,
{
}
-LLPickInfo::~LLPickInfo()
-{
-}
-
void LLPickInfo::fetchResults()
{
@@ -4954,59 +4752,14 @@ void LLPickInfo::fetchResults()
NULL, -1, mPickTransparent, &face_hit,
&intersection, &uv, &normal, &binormal);
- // read back colors and depth values from buffer
- //glReadPixels(mScreenRegion.mLeft, mScreenRegion.mBottom, mScreenRegion.getWidth(), mScreenRegion.getHeight(), GL_RGBA, GL_UNSIGNED_BYTE, mPickBuffer);
- //glReadPixels(mScreenRegion.mLeft, mScreenRegion.mBottom, mScreenRegion.getWidth(), mScreenRegion.getHeight(), GL_DEPTH_COMPONENT, GL_UNSIGNED_INT, mPickDepthBuffer );
-
- // find pick region that is fully onscreen
- LLCoordGL scaled_pick_point;;
- scaled_pick_point.mX = llclamp(llround((F32)mMousePt.mX * gViewerWindow->getDisplayScale().mV[VX]), PICK_HALF_WIDTH, gViewerWindow->getWorldViewWidth() - PICK_HALF_WIDTH);
- scaled_pick_point.mY = llclamp(llround((F32)mMousePt.mY * gViewerWindow->getDisplayScale().mV[VY]), PICK_HALF_WIDTH, gViewerWindow->getWorldViewHeight() - PICK_HALF_WIDTH);
- //S32 pixel_index = PICK_HALF_WIDTH * PICK_DIAMETER + PICK_HALF_WIDTH;
- //S32 pick_id = (U32)mPickBuffer[(pixel_index * 4) + 0] << 16 | (U32)mPickBuffer[(pixel_index * 4) + 1] << 8 | (U32)mPickBuffer[(pixel_index * 4) + 2];
- //F32 depth = mPickDepthBuffer[pixel_index];
-
- //S32 x_offset = mMousePt.mX - llround((F32)scaled_pick_point.mX / gViewerWindow->getDisplayScale().mV[VX]);
- //S32 y_offset = mMousePt.mY - llround((F32)scaled_pick_point.mY / gViewerWindow->getDisplayScale().mV[VY]);
-
mPickPt = mMousePt;
- // we hit nothing, scan surrounding pixels for something useful
- /*if (!pick_id)
- {
- S32 closest_distance = 10000;
- //S32 closest_pick_name = 0;
- for (S32 col = 0; col < PICK_DIAMETER; col++)
- {
- for (S32 row = 0; row < PICK_DIAMETER; row++)
- {
- S32 distance_squared = (llabs(col - x_offset - PICK_HALF_WIDTH) * llabs(col - x_offset - PICK_HALF_WIDTH)) + (llabs(row - y_offset - PICK_HALF_WIDTH) * llabs(row - y_offset - PICK_HALF_WIDTH));
- pixel_index = row * PICK_DIAMETER + col;
- S32 test_name = (U32)mPickBuffer[(pixel_index * 4) + 0] << 16 | (U32)mPickBuffer[(pixel_index * 4) + 1] << 8 | (U32)mPickBuffer[(pixel_index * 4) + 2];
- if (test_name && distance_squared < closest_distance)
- {
- closest_distance = distance_squared;
- pick_id = test_name;
- depth = mPickDepthBuffer[pixel_index];
- mPickPt.mX = mMousePt.mX + (col - PICK_HALF_WIDTH);
- mPickPt.mY = mMousePt.mY + (row - PICK_HALF_WIDTH);
- }
- }
- }
- }*/
-
-
U32 te_offset = face_hit > -1 ? face_hit : 0;
- //pick_id &= 0x000fffff;
//unproject relative clicked coordinate from window coordinate using GL
LLViewerObject* objectp = hit_object;
- //if (pick_id == (S32)GL_NAME_PARCEL_WALL)
- //{
- // mPickType = PICK_PARCEL_WALL;
- //}
if (hit_icon &&
(!objectp ||
icon_dist < (LLViewerCamera::getInstance()->getOrigin()-intersection).magVec()))
@@ -5046,24 +4799,10 @@ void LLPickInfo::fetchResults()
{
mPickType = PICK_OBJECT;
}
- mObjectOffset = gAgent.calcFocusOffset(objectp, intersection, mPickPt.mX, mPickPt.mY);
+ mObjectOffset = gAgentCamera.calcFocusOffset(objectp, intersection, mPickPt.mX, mPickPt.mY);
mObjectID = objectp->mID;
mObjectFace = (te_offset == NO_FACE) ? -1 : (S32)te_offset;
- /*glh::matrix4f newModel((F32*)LLViewerCamera::getInstance()->getModelview().mMatrix);
-
- for(U32 i = 0; i < 16; ++i)
- {
- modelview[i] = newModel.m[i];
- projection[i] = LLViewerCamera::getInstance()->getProjection().mMatrix[i/4][i%4];
- }
- glGetIntegerv( GL_VIEWPORT, viewport );
-
- winX = ((F32)mPickPt.mX) * gViewerWindow->getDisplayScale().mV[VX];
- winY = ((F32)mPickPt.mY) * gViewerWindow->getDisplayScale().mV[VY];
-
- gluUnProject( winX, winY, depth, modelview, projection, viewport, &posX, &posY, &posZ);*/
-
mPosGlobal = gAgent.getPosGlobalFromAgent(intersection);
if (mWantSurfaceInfo)
@@ -5089,62 +4828,15 @@ void LLPickInfo::updateXYCoords()
if (mObjectFace > -1)
{
const LLTextureEntry* tep = getObject()->getTE(mObjectFace);
- LLPointer<LLViewerImage> imagep = gImageList.getImage(tep->getID());
+ LLPointer<LLViewerTexture> imagep = LLViewerTextureManager::getFetchedTexture(tep->getID());
if(mUVCoords.mV[VX] >= 0.f && mUVCoords.mV[VY] >= 0.f && imagep.notNull())
{
- LLCoordGL coords;
-
- coords.mX = llround(mUVCoords.mV[VX] * (F32)imagep->getWidth());
- coords.mY = llround(mUVCoords.mV[VY] * (F32)imagep->getHeight());
-
- gViewerWindow->getWindow()->convertCoords(coords, &mXYCoords);
+ mXYCoords.mX = llround(mUVCoords.mV[VX] * (F32)imagep->getWidth());
+ mXYCoords.mY = llround((1.f - mUVCoords.mV[VY]) * (F32)imagep->getHeight());
}
}
}
-void LLPickInfo::drawPickBuffer() const
-{
- if (mPickBuffer)
- {
- gGL.pushMatrix();
- LLGLDisable no_blend(GL_BLEND);
- LLGLDisable no_alpha_test(GL_ALPHA_TEST);
- gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
- glPixelZoom(10.f, 10.f);
- LLVector2 display_scale = gViewerWindow->getDisplayScale();
- glRasterPos2f(((F32)mMousePt.mX * display_scale.mV[VX] + 10.f),
- ((F32)mMousePt.mY * display_scale.mV[VY] + 10.f));
- glDrawPixels(PICK_DIAMETER, PICK_DIAMETER, GL_RGBA, GL_UNSIGNED_BYTE, mPickBuffer);
- glPixelZoom(1.f, 1.f);
- gGL.color4fv(LLColor4::white.mV);
- gl_rect_2d(llround((F32)mMousePt.mX * display_scale.mV[VX] - (F32)(PICK_HALF_WIDTH)),
- llround((F32)mMousePt.mY * display_scale.mV[VY] + (F32)(PICK_HALF_WIDTH)),
- llround((F32)mMousePt.mX * display_scale.mV[VX] + (F32)(PICK_HALF_WIDTH)),
- llround((F32)mMousePt.mY * display_scale.mV[VY] - (F32)(PICK_HALF_WIDTH)),
- FALSE);
- gl_line_2d(llround((F32)mMousePt.mX * display_scale.mV[VX] - (F32)(PICK_HALF_WIDTH)),
- llround((F32)mMousePt.mY * display_scale.mV[VY] + (F32)(PICK_HALF_WIDTH)),
- llround((F32)mMousePt.mX * display_scale.mV[VX] + 10.f),
- llround((F32)mMousePt.mY * display_scale.mV[VY] + (F32)(PICK_DIAMETER) * 10.f + 10.f));
- gl_line_2d(llround((F32)mMousePt.mX * display_scale.mV[VX] + (F32)(PICK_HALF_WIDTH)),
- llround((F32)mMousePt.mY * display_scale.mV[VY] - (F32)(PICK_HALF_WIDTH)),
- llround((F32)mMousePt.mX * display_scale.mV[VX] + (F32)(PICK_DIAMETER) * 10.f + 10.f),
- llround((F32)mMousePt.mY * display_scale.mV[VY] + 10.f));
- gGL.translatef(10.f, 10.f, 0.f);
- gl_rect_2d(llround((F32)mPickPt.mX * display_scale.mV[VX]),
- llround((F32)mPickPt.mY * display_scale.mV[VY] + (F32)(PICK_DIAMETER) * 10.f),
- llround((F32)mPickPt.mX * display_scale.mV[VX] + (F32)(PICK_DIAMETER) * 10.f),
- llround((F32)mPickPt.mY * display_scale.mV[VY]),
- FALSE);
- gl_rect_2d(llround((F32)mPickPt.mX * display_scale.mV[VX]),
- llround((F32)mPickPt.mY * display_scale.mV[VY] + 10.f),
- llround((F32)mPickPt.mX * display_scale.mV[VX] + 10.f),
- llround((F32)mPickPt.mY * display_scale.mV[VY]),
- FALSE);
- gGL.popMatrix();
- }
-}
-
void LLPickInfo::getSurfaceInfo()
{
// set values to uninitialized - this is what we return if no intersection is found