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.cpp1368
1 files changed, 683 insertions, 685 deletions
diff --git a/indra/newview/llviewerwindow.cpp b/indra/newview/llviewerwindow.cpp
index cbda0e8a64..fb501b023f 100644
--- a/indra/newview/llviewerwindow.cpp
+++ b/indra/newview/llviewerwindow.cpp
@@ -36,7 +36,9 @@
#include <stdio.h>
#include <iostream>
#include <fstream>
+#include <algorithm>
+#include "llfloaterreg.h"
#include "llpanellogin.h"
#include "llviewerkeyboard.h"
#include "llviewerwindow.h"
@@ -48,7 +50,6 @@
#include "llvoiceclient.h" // for push-to-talk button handling
-
//
// TODO: Many of these includes are unnecessary. Remove them.
//
@@ -57,6 +58,7 @@
#include "audioengine.h" // mute on minimize
#include "indra_constants.h"
#include "llassetstorage.h"
+#include "llerrorcontrol.h"
#include "llfontgl.h"
#include "llmousehandler.h"
#include "llrect.h"
@@ -98,16 +100,15 @@
#include "llfloaterchat.h"
#include "llfloaterchatterbox.h"
#include "llfloatercustomize.h"
-#include "llfloatereditui.h" // HACK JAMESDEBUG for ui editor
#include "llfloaterland.h"
#include "llfloaterinspect.h"
+#include "llfloatermap.h"
#include "llfloaternamedesc.h"
#include "llfloaterpreference.h"
#include "llfloatersnapshot.h"
#include "llfloatertools.h"
#include "llfloaterworldmap.h"
#include "llfocusmgr.h"
-#include "llframestatview.h"
#include "llgesturemgr.h"
#include "llglheaders.h"
#include "llhoverview.h"
@@ -122,13 +123,15 @@
#include "llmodaldialog.h"
#include "llmorphview.h"
#include "llmoveview.h"
+#include "llnavigationbar.h"
#include "llnotify.h"
#include "lloverlaybar.h"
#include "llpreviewtexture.h"
#include "llprogressview.h"
#include "llresmgr.h"
-#include "llrootview.h"
+#include "llsidetray.h"
#include "llselectmgr.h"
+#include "llrootview.h"
#include "llrendersphere.h"
#include "llstartup.h"
#include "llstatusbar.h"
@@ -151,9 +154,8 @@
#include "lltoolmgr.h"
#include "lltoolmorph.h"
#include "lltoolpie.h"
-#include "lltoolplacer.h"
#include "lltoolselectland.h"
-#include "lltoolview.h"
+#include "lltrans.h"
#include "lluictrlfactory.h"
#include "lluploaddialog.h"
#include "llurldispatcher.h" // SLURL from other app instance
@@ -170,7 +172,7 @@
#include "llviewerregion.h"
#include "llviewershadermgr.h"
#include "llviewerstats.h"
-#include "llvoavatar.h"
+#include "llvoavatarself.h"
#include "llvovolume.h"
#include "llworld.h"
#include "llworldmapview.h"
@@ -182,10 +184,12 @@
#include "llviewerjoystick.h"
#include "llviewernetwork.h"
#include "llpostprocess.h"
+#include "llbottomtray.h"
-#include "llfloatertest.h" // HACK!
#include "llfloaternotificationsconsole.h"
+#include "llnearbychathistory.h"
+
#if LL_WINDOWS
#include <tchar.h> // For Unicode conversion methods
#endif
@@ -194,7 +198,6 @@
// Globals
//
void render_ui(F32 zoom_factor = 1.f, int subfield = 0);
-LLBottomPanel* gBottomPanel = NULL;
extern BOOL gDebugClicks;
extern BOOL gDisplaySwapBuffers;
@@ -203,7 +206,6 @@ extern BOOL gResizeScreenTexture;
extern S32 gJamesInt;
LLViewerWindow *gViewerWindow = NULL;
-LLVelocityBar *gVelocityBar = NULL;
BOOL gDebugSelect = FALSE;
@@ -249,7 +251,27 @@ 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::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);
+ }
+ }
+ }
+};
////////////////////////////////////////////////////////////////////////////
//
@@ -557,7 +579,7 @@ public:
const Line& line = *iter;
LLFontGL::getFontMonospace()->renderUTF8(line.text, 0, (F32)line.x, (F32)line.y, mTextColor,
LLFontGL::LEFT, LLFontGL::TOP,
- LLFontGL::NORMAL, S32_MAX, S32_MAX, NULL, FALSE);
+ LLFontGL::NORMAL, LLFontGL::NO_SHADOW, S32_MAX, S32_MAX, NULL, FALSE);
}
mLineList.clear();
}
@@ -1186,6 +1208,27 @@ void LLViewerWindow::handlePauseWatchdog(LLWindow *window)
LLAppViewer::instance()->pauseMainloopTimeout();
}
+//virtual
+std::string LLViewerWindow::translateString(const char* tag)
+{
+ return LLTrans::getString( std::string(tag) );
+}
+
+//virtual
+std::string LLViewerWindow::translateString(const char* tag,
+ const std::map<std::string, std::string>& args)
+{
+ // LLTrans uses a special subclass of std::string for format maps,
+ // but we must use std::map<> in these callbacks, otherwise we create
+ // a dependency between LLWindow and LLFormatMapString. So copy the data.
+ LLStringUtil::format_map_t args_copy;
+ std::map<std::string,std::string>::const_iterator it = args.begin();
+ for ( ; it != args.end(); ++it)
+ {
+ args_copy[it->first] = it->second;
+ }
+ return LLTrans::getString( std::string(tag), args_copy);
+}
//
// Classes
@@ -1196,11 +1239,13 @@ LLViewerWindow::LLViewerWindow(
S32 width, S32 height,
BOOL fullscreen, BOOL ignore_pixel_depth)
:
+ mWindow(NULL),
mActive(TRUE),
mWantFullscreen(fullscreen),
mShowFullscreenProgress(FALSE),
mWindowRect(0, height, width, 0),
mVirtualWindowRect(0, height, width, 0),
+ mWorldViewRect(0, height, width, 0),
mLeftMouseDown(FALSE),
mMiddleMouseDown(FALSE),
mRightMouseDown(FALSE),
@@ -1231,7 +1276,7 @@ LLViewerWindow::LLViewerWindow(
resetSnapshotLoc();
// create window
- mWindow = LLWindowManager::createWindow(
+ mWindow = LLWindowManager::createWindow(this,
title, name, x, y, width, height, 0,
fullscreen,
gNoRender,
@@ -1306,26 +1351,31 @@ LLViewerWindow::LLViewerWindow(
mInitAlert = "DisplaySettingsNoShaders";
LLFeatureManager::getInstance()->setGraphicsLevel(0, false);
gSavedSettings.setU32("RenderQualityPerformance", 0);
-
}
- // set callbacks
- mWindow->setCallbacks(this);
-
// Init the image list. Must happen after GL is initialized and before the images that
// LLViewerWindow needs are requested.
gImageList.init();
LLViewerImage::initClass();
gBumpImageList.init();
-
+
+ // Init font system, but don't actually load the fonts yet
+ // because our window isn't onscreen and they take several
+ // seconds to parse.
+ LLFontGL::initClass( gSavedSettings.getF32("FontScreenDPI"),
+ mDisplayScale.mV[VX],
+ mDisplayScale.mV[VY],
+ gDirUtilp->getAppRODataDir(),
+ LLUI::getXUIPaths());
+
// Create container for all sub-views
- mRootView = new LLRootView("root", mVirtualWindowRect, FALSE);
-
- if (!gNoRender)
- {
- // Init default fonts
- initFonts();
- }
+ LLView::Params rvp;
+ rvp.name("root");
+ rvp.rect(mVirtualWindowRect);
+ 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;
@@ -1381,8 +1431,6 @@ void LLViewerWindow::initBase()
LLRect full_window(0, height, width, 0);
- adjustRectanglesForFirstUse(full_window);
-
////////////////////
//
// Set the gamma
@@ -1402,41 +1450,57 @@ void LLViewerWindow::initBase()
// Constrain floaters to inside the menu and status bar regions.
LLRect floater_view_rect = full_window;
- // make space for menu bar if we have one
+ // make space for menu bar
floater_view_rect.mTop -= MENU_BAR_HEIGHT;
- // TODO: Eliminate magic constants - please used named constants if changing this
- floater_view_rect.mBottom += STATUS_BAR_HEIGHT + 12 + 16 + 2;
-
- // Check for non-first startup
- S32 floater_view_bottom = gSavedSettings.getS32("FloaterViewBottom");
- if (floater_view_bottom >= 0)
- {
- floater_view_rect.mBottom = floater_view_bottom;
- }
- gFloaterView = new LLFloaterView("Floater View", floater_view_rect );
- gFloaterView->setVisible(TRUE);
-
- gSnapshotFloaterView = new LLSnapshotFloaterView("Snapshot Floater View", full_window);
+ 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);
+
// Snapshot floater must start invisible otherwise it eats all
// the tooltips. JC
gSnapshotFloaterView->setVisible(FALSE);
// Console
llassert( !gConsole );
- gConsole = new LLConsole(
- "console",
- gSavedSettings.getS32("ConsoleBufferSize"),
- getChatConsoleRect(),
- gSavedSettings.getS32("ChatFontSize"),
- gSavedSettings.getF32("ChatPersistTime") );
- gConsole->setFollows(FOLLOWS_LEFT | FOLLOWS_RIGHT | FOLLOWS_BOTTOM);
+ LLConsole::Params cp;
+ cp.name("console");
+ cp.max_lines(gSavedSettings.getS32("ConsoleBufferSize"));
+ cp.rect(getChatConsoleRect());
+ cp.persist_time(gSavedSettings.getF32("ChatPersistTime"));
+ cp.font_size_index(gSavedSettings.getS32("ChatFontSize"));
+ cp.follows.flags(FOLLOWS_LEFT | FOLLOWS_RIGHT | FOLLOWS_BOTTOM);
+ gConsole = LLUICtrlFactory::create<LLConsole>(cp);
mRootView->addChild(gConsole);
+ // optionally forward warnings to chat console/chat floater
+ // for qa runs and dev builds
+#if !LL_RELEASE_FOR_DOWNLOAD
+ LLError::addRecorder(RecordToChatConsole::getInstance());
+#else
+ if(gSavedSettings.getBOOL("QAMode"))
+ {
+ LLError::addRecorder(RecordToChatConsole::getInstance());
+ }
+#endif
+
// Debug view over the console
- gDebugView = new LLDebugView("gDebugView", full_window);
- gDebugView->setFollowsAll();
- gDebugView->setVisible(TRUE);
+ 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
@@ -1444,278 +1508,154 @@ void LLViewerWindow::initBase()
mRootView->addChild(gSnapshotFloaterView);
// notify above floaters!
- LLRect notify_rect = full_window;
- //notify_rect.mTop -= 24;
- notify_rect.mBottom += STATUS_BAR_HEIGHT;
- gNotifyBoxView = new LLNotifyBoxView("notify_container", notify_rect, FALSE, FOLLOWS_ALL);
+ 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
- mToolTip = new LLTextBox( std::string("tool tip"), LLRect(0, 1, 1, 0 ) );
- mToolTip->setHPad( 4 );
- mToolTip->setVPad( 2 );
- mToolTip->setColor( gColors.getColor( "ToolTipTextColor" ) );
- mToolTip->setBorderColor( gColors.getColor( "ToolTipBorderColor" ) );
- mToolTip->setBorderVisible( FALSE );
- mToolTip->setBackgroundColor( gColors.getColor( "ToolTipBgColor" ) );
- mToolTip->setBackgroundVisible( TRUE );
- mToolTip->setFontStyle(LLFontGL::NORMAL);
- mToolTip->setBorderDropshadowVisible( TRUE );
- mToolTip->setVisible( FALSE );
+ 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);
// Add the progress bar view (startup view), which overrides everything
- mProgressView = new LLProgressView(std::string("ProgressView"), full_window);
+ mProgressView = new LLProgressView(full_window);
mRootView->addChild(mProgressView);
setShowProgress(FALSE);
setProgressCancelButtonVisible(FALSE);
}
-
-void adjust_rect_top_left(const std::string& control, const LLRect& window)
+void LLViewerWindow::initWorldUI()
{
- LLRect r = gSavedSettings.getRect(control);
- if (r.mLeft == 0 && r.mBottom == 0)
- {
- r.setLeftTopAndSize(0, window.getHeight(), r.getWidth(), r.getHeight());
- gSavedSettings.setRect(control, r);
- }
-}
+ S32 height = mRootView->getRect().getHeight();
+ S32 width = mRootView->getRect().getWidth();
+ LLRect full_window(0, height, width, 0);
-void adjust_rect_top_center(const std::string& control, const LLRect& window)
-{
- LLRect r = gSavedSettings.getRect(control);
- if (r.mLeft == 0 && r.mBottom == 0)
- {
- r.setLeftTopAndSize( window.getWidth()/2 - r.getWidth()/2,
- window.getHeight(),
- r.getWidth(),
- r.getHeight() );
- gSavedSettings.setRect(control, r);
- }
-}
+ gIMMgr = LLIMMgr::getInstance();
-void adjust_rect_top_right(const std::string& control, const LLRect& window)
-{
- LLRect r = gSavedSettings.getRect(control);
- if (r.mLeft == 0 && r.mBottom == 0)
+ // 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)
{
- r.setLeftTopAndSize(window.getWidth() - r.getWidth(),
- window.getHeight(),
- r.getWidth(),
- r.getHeight());
- gSavedSettings.setRect(control, r);
+ LLRect cr = gConsole->getRect();
+ cr.mBottom += LLBottomTray::getInstance()->getRect().getHeight();
+ gConsole->setRect(cr);
}
-}
-// *TODO: Adjust based on XUI XML
-const S32 TOOLBAR_HEIGHT = 64;
+ // View for hover information
+ LLHoverView::Params hvp;
+ hvp.name("gHoverview");
+ hvp.rect(full_window);
+ gHoverView = LLUICtrlFactory::create<LLHoverView>(hvp);
+ mRootView->addChild(gHoverView);
-void adjust_rect_bottom_left(const std::string& control, const LLRect& window)
-{
- LLRect r = gSavedSettings.getRect(control);
- if (r.mLeft == 0 && r.mBottom == 0)
- {
- r.setOriginAndSize(0, TOOLBAR_HEIGHT, r.getWidth(), r.getHeight());
- gSavedSettings.setRect(control, r);
- }
-}
+ // Pre initialize instance communicate instance;
+ // currently needs to happen before initializing chat or IM
+ LLFloaterReg::getInstance("communicate");
-void adjust_rect_bottom_center(const std::string& control, const LLRect& window)
-{
- LLRect r = gSavedSettings.getRect(control);
- if (r.mLeft == 0 && r.mBottom == 0)
+ if ( gSavedPerAccountSettings.getBOOL("LogShowHistory") )
{
- r.setOriginAndSize(
- window.getWidth()/2 - r.getWidth()/2,
- TOOLBAR_HEIGHT,
- r.getWidth(),
- r.getHeight());
- gSavedSettings.setRect(control, r);
+ LLFloaterChat::loadHistory();
}
-}
-void adjust_rect_centered_partial_zoom(const std::string& control,
- const LLRect& window)
-{
- LLRect rect = gSavedSettings.getRect(control);
- // Only adjust on first use
- if (rect.mLeft == 0 && rect.mBottom == 0)
- {
- S32 width = window.getWidth();
- S32 height = window.getHeight();
- rect.set(0, height-STATUS_BAR_HEIGHT, width, TOOL_BAR_HEIGHT);
- // Make floater fill 80% of window, leaving 20% padding on
- // the sides.
- const F32 ZOOM_FRACTION = 0.8f;
- S32 dx = (S32)(width * (1.f - ZOOM_FRACTION));
- S32 dy = (S32)(height * (1.f - ZOOM_FRACTION));
- rect.stretch(-dx/2, -dy/2);
- gSavedSettings.setRect(control, rect);
- }
-}
+ LLRect morph_view_rect = full_window;
+ morph_view_rect.stretch( -STATUS_BAR_HEIGHT );
+ morph_view_rect.mTop = full_window.mTop - 32;
+ LLMorphView::Params mvp;
+ mvp.name("MorphView");
+ 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);
-// Many rectangles can't be placed until we know the screen size.
-// These rectangles have their bottom-left corner as 0,0
-void LLViewerWindow::adjustRectanglesForFirstUse(const LLRect& window)
-{
- LLRect r;
+ // *Note: this is where gFloaterMute used to be initialized.
- // *NOTE: The width and height of these floaters must be
- // identical in settings.xml and their relevant floater.xml
- // files, otherwise the window construction will get
- // confused. JC
- adjust_rect_bottom_center("FloaterMoveRect2", window);
-
- adjust_rect_top_center("FloaterCameraRect3", window);
-
- adjust_rect_top_left("FloaterCustomizeAppearanceRect", window);
-
- adjust_rect_top_left("FloaterLandRect5", window);
-
- adjust_rect_top_left("FloaterFindRect2", window);
-
- adjust_rect_top_left("FloaterGestureRect2", window);
-
- adjust_rect_top_right("FloaterMiniMapRect", window);
+ LLWorldMapView::initClass();
- adjust_rect_top_right("FloaterLagMeter", window);
-
- adjust_rect_top_left("FloaterBuildOptionsRect", window);
-
- adjust_rect_bottom_left("FloaterActiveSpeakersRect", window);
-
- adjust_rect_bottom_left("FloaterBumpRect", window);
-
- adjust_rect_bottom_left("FloaterRegionInfo", window);
-
- adjust_rect_bottom_left("FloaterEnvRect", window);
-
- adjust_rect_bottom_left("FloaterAdvancedSkyRect", window);
-
- adjust_rect_bottom_left("FloaterAdvancedWaterRect", window);
-
- adjust_rect_bottom_left("FloaterDayCycleRect", window);
-
- adjust_rect_top_right("FloaterStatisticsRect", window);
-
-
- // bottom-right
- r = gSavedSettings.getRect("FloaterInventoryRect");
- if (r.mLeft == 0 && r.mBottom == 0)
- {
- r.setOriginAndSize(
- window.getWidth() - r.getWidth(),
- 0,
- r.getWidth(),
- r.getHeight());
- gSavedSettings.setRect("FloaterInventoryRect", r);
- }
+ // 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());
+ // sync bg color with menu bar
+ gStatusBar->setBackgroundColor( gMenuBarView->getBackgroundColor().get() );
+
+ // Navigation bar
+
+ 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->setBackgroundColor(gMenuBarView->getBackgroundColor().get());
-// adjust_rect_top_left("FloaterHUDRect2", window);
-
- // slightly off center to be left of the avatar.
- r = gSavedSettings.getRect("FloaterHUDRect2");
- if (r.mLeft == 0 && r.mBottom == 0)
- {
- r.setOriginAndSize(
- window.getWidth()/4 - r.getWidth()/2,
- 2*window.getHeight()/3 - r.getHeight()/2,
- r.getWidth(),
- r.getHeight());
- gSavedSettings.setRect("FloaterHUDRect2", r);
- }
-}
-
-//Rectangles need to be adjusted after the window is constructed
-//in order for proper centering to take place
-void LLViewerWindow::adjustControlRectanglesForFirstUse(const LLRect& window)
-{
- adjust_rect_bottom_center("FloaterMoveRect2", window);
- adjust_rect_top_center("FloaterCameraRect3", window);
-}
-
-void LLViewerWindow::initWorldUI()
-{
- pre_init_menus();
-
- S32 height = mRootView->getRect().getHeight();
- S32 width = mRootView->getRect().getWidth();
- LLRect full_window(0, height, width, 0);
-
- if ( gBottomPanel == NULL ) // Don't re-enter if objects are alreay created
- {
- // panel containing chatbar, toolbar, and overlay, over floaters
- gBottomPanel = new LLBottomPanel(mRootView->getRect());
- mRootView->addChild(gBottomPanel);
-
- // View for hover information
- gHoverView = new LLHoverView(std::string("gHoverView"), full_window);
- gHoverView->setVisible(TRUE);
- mRootView->addChild(gHoverView);
-
- gIMMgr = LLIMMgr::getInstance();
-
- if ( gSavedPerAccountSettings.getBOOL("LogShowHistory") )
- {
- LLFloaterChat::getInstance(LLSD())->loadHistory();
- }
-
- LLRect morph_view_rect = full_window;
- morph_view_rect.stretch( -STATUS_BAR_HEIGHT );
- morph_view_rect.mTop = full_window.mTop - 32;
- gMorphView = new LLMorphView(std::string("gMorphView"), morph_view_rect );
- mRootView->addChild(gMorphView);
- gMorphView->setVisible(FALSE);
-
- // *Note: this is where gFloaterMute used to be initialized.
-
- LLWorldMapView::initClass();
-
- adjust_rect_centered_partial_zoom("FloaterWorldMapRect2", full_window);
-
- gFloaterWorldMap = new LLFloaterWorldMap();
- gFloaterWorldMap->setVisible(FALSE);
-
- //
- // Tools for building
- //
-
- // Toolbox floater
- init_menus();
-
- gFloaterTools = new LLFloaterTools();
- gFloaterTools->setVisible(FALSE);
-
- // 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(std::string("status"), 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());
- // sync bg color with menu bar
- gStatusBar->setBackgroundColor( gMenuBarView->getBackgroundColor() );
+ getRootView()->addChild(gStatusBar);
+ getRootView()->addChild(navbar);
- LLFloaterChatterBox::createInstance(LLSD());
+ // side tray
+ getRootView()->addChild(LLSideTray::getInstance());
- getRootView()->addChild(gStatusBar);
-
- // menu holder appears on top to get first pass at all mouse events
- getRootView()->sendChildToFront(gMenuHolder);
- }
+ //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);
}
// Destroy the UI
void LLViewerWindow::shutdownViews()
{
+ // clean up warning logger
+ LLError::removeRecorder(RecordToChatConsole::getInstance());
+
delete mDebugText;
mDebugText = NULL;
- gSavedSettings.setS32("FloaterViewBottom", gFloaterView->getRect().mBottom);
-
// Cleanup global views
if (gMorphView)
{
@@ -1727,7 +1667,6 @@ void LLViewerWindow::shutdownViews()
mRootView = NULL;
// Automatically deleted as children of mRootView. Fix the globals.
- gFloaterTools = NULL;
gStatusBar = NULL;
gIMMgr = NULL;
gHoverView = NULL;
@@ -1829,8 +1768,8 @@ void LLViewerWindow::sendShapeToSim()
msg->addU32Fast(_PREHASH_CircuitCode, gMessageSystem->mOurCircuitCode);
msg->nextBlockFast(_PREHASH_HeightWidthBlock);
msg->addU32Fast(_PREHASH_GenCounter, 0);
- U16 height16 = (U16) mWindowRect.getHeight();
- U16 width16 = (U16) mWindowRect.getWidth();
+ U16 height16 = (U16) mWorldViewRect.getHeight();
+ U16 width16 = (U16) mWorldViewRect.getWidth();
msg->addU16Fast(_PREHASH_Height, height16);
msg->addU16Fast(_PREHASH_Width, width16);
gAgent.sendReliableMessage();
@@ -1851,25 +1790,18 @@ void LLViewerWindow::reshape(S32 width, S32 height)
return;
}
- glViewport(0, 0, width, height );
+ // update our window rectangle
+ mWindowRect.mRight = mWindowRect.mLeft + width;
+ mWindowRect.mTop = mWindowRect.mBottom + height;
+
+ //glViewport(0, 0, width, height );
if (height > 0)
{
- LLViewerCamera::getInstance()->setViewHeightInPixels( height );
- if (mWindow->getFullscreen())
- {
- // force to 4:3 aspect for odd resolutions
- LLViewerCamera::getInstance()->setAspect( getDisplayAspectRatio() );
- }
- else
- {
- LLViewerCamera::getInstance()->setAspect( width / (F32) height);
- }
+ LLViewerCamera::getInstance()->setViewHeightInPixels( mWorldViewRect.getHeight() );
+ LLViewerCamera::getInstance()->setAspect( getWorldViewAspectRatio() );
}
- // update our window rectangle
- mWindowRect.mRight = mWindowRect.mLeft + width;
- mWindowRect.mTop = mWindowRect.mBottom + height;
calcDisplayScale();
BOOL display_scale_changed = mDisplayScale != LLUI::sGLScaleFactor;
@@ -1879,7 +1811,7 @@ void LLViewerWindow::reshape(S32 width, S32 height)
mVirtualWindowRect.mRight = mVirtualWindowRect.mLeft + llround((F32)width / mDisplayScale.mV[VX]);
mVirtualWindowRect.mTop = mVirtualWindowRect.mBottom + llround((F32)height / mDisplayScale.mV[VY]);
- setupViewport();
+ setup2DViewport();
// Inform lower views of the change
// round up when converting coordinates to make sure there are no gaps at edge of window
@@ -1897,7 +1829,7 @@ void LLViewerWindow::reshape(S32 width, S32 height)
// store the mode the user wants (even if not there yet)
- gSavedSettings.setBOOL("FullScreen", mWantFullscreen);
+ gSavedSettings.setBOOL("NotFullScreen", !mWantFullscreen);
// store new settings for the mode we are in, regardless
if (!mWindow->getFullscreen())
@@ -1917,7 +1849,6 @@ void LLViewerWindow::reshape(S32 width, S32 height)
LLViewerStats::getInstance()->setStat(LLViewerStats::ST_WINDOW_WIDTH, (F64)width);
LLViewerStats::getInstance()->setStat(LLViewerStats::ST_WINDOW_HEIGHT, (F64)height);
- gResizeScreenTexture = TRUE;
}
}
@@ -1925,11 +1856,8 @@ void LLViewerWindow::reshape(S32 width, S32 height)
// Hide normal UI when a logon fails
void LLViewerWindow::setNormalControlsVisible( BOOL visible )
{
- if ( gBottomPanel )
- {
- gBottomPanel->setVisible( visible );
- gBottomPanel->setEnabled( visible );
- }
+ LLBottomTray::getInstance()->setVisible(visible);
+ LLBottomTray::getInstance()->setEnabled(visible);
if ( gMenuBarView )
{
@@ -1946,6 +1874,12 @@ void LLViewerWindow::setNormalControlsVisible( BOOL visible )
gStatusBar->setVisible( visible );
gStatusBar->setEnabled( visible );
}
+
+ LLNavigationBar* navbarp = LLUI::getRootView()->findChild<LLNavigationBar>("navigation_bar");
+ if (navbarp)
+ {
+ navbarp->setVisible( visible );
+ }
}
void LLViewerWindow::setMenuBackgroundColor(bool god_mode, bool dev_grid)
@@ -1955,19 +1889,19 @@ void LLViewerWindow::setMenuBackgroundColor(bool god_mode, bool dev_grid)
if(god_mode && LLViewerLogin::getInstance()->isInProductionGrid())
{
- new_bg_color = gColors.getColor( "MenuBarGodBgColor" );
+ new_bg_color = gSavedSkinSettings.getColor( "MenuBarGodBgColor" );
}
else if(god_mode && !LLViewerLogin::getInstance()->isInProductionGrid())
{
- new_bg_color = gColors.getColor( "MenuNonProductionGodBgColor" );
+ new_bg_color = gSavedSkinSettings.getColor( "MenuNonProductionGodBgColor" );
}
else if(!god_mode && !LLViewerLogin::getInstance()->isInProductionGrid())
{
- new_bg_color = gColors.getColor( "MenuNonProductionBgColor" );
+ new_bg_color = gSavedSkinSettings.getColor( "MenuNonProductionBgColor" );
}
else
{
- new_bg_color = gColors.getColor( "MenuBarBgColor" );
+ new_bg_color = gSavedSkinSettings.getColor( "MenuBarBgColor" );
}
if(gMenuBarView)
@@ -1978,6 +1912,7 @@ void LLViewerWindow::setMenuBackgroundColor(bool god_mode, bool dev_grid)
if(gStatusBar)
{
gStatusBar->setBackgroundColor( new_bg_color );
+ gStatusBar->getChild<LLTextBox>("HealthText")->setBackgroundColor(new_bg_color);
}
}
@@ -2021,7 +1956,7 @@ void LLViewerWindow::draw()
glLoadIdentity();
microsecondsToTimecodeString(gFrameTime,text);
- const LLFontGL* font = LLResMgr::getInstance()->getRes( LLFONT_SANSSERIF );
+ const LLFontGL* font = LLFontGL::getFontSansSerif();
font->renderUTF8(text, 0,
llround((getWindowWidth()/2)-100.f),
llround((getWindowHeight()-60.f)),
@@ -2126,6 +2061,9 @@ void LLViewerWindow::draw()
#if LL_DEBUG
LLView::sIsDrawing = FALSE;
#endif
+
+ // UI post-draw Updates
+ gNotifyBoxView->updateNotifyBoxView();
}
// Takes a single keydown event, usually when UI is visible
@@ -2144,14 +2082,14 @@ BOOL LLViewerWindow::handleKey(KEY key, MASK mask)
}
}
- // HACK look for UI editing keys
- if (LLView::sEditingUI)
- {
- if (LLFloaterEditUI::processKeystroke(key, mask))
- {
- return TRUE;
- }
- }
+ //// 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
@@ -2193,7 +2131,8 @@ BOOL LLViewerWindow::handleKey(KEY key, MASK mask)
&& (MASK_CONTROL & mask)
&& ('5' == key))
{
- LLFloaterNotificationConsole::showInstance();
+ //LLFloaterNotificationConsole::showInstance();
+ LLFloaterReg::showInstance("notifications_console");
return TRUE;
}
@@ -2434,8 +2373,8 @@ void LLViewerWindow::handleScrollWheel(S32 clicks)
void LLViewerWindow::moveCursorToCenter()
{
- S32 x = mVirtualWindowRect.getWidth() / 2;
- S32 y = mVirtualWindowRect.getHeight() / 2;
+ S32 x = mWorldViewRect.getWidth() / 2;
+ S32 y = mWorldViewRect.getHeight() / 2;
//on a forced move, all deltas get zeroed out to prevent jumping
mCurrentMousePoint.set(x,y);
@@ -2452,103 +2391,139 @@ void LLViewerWindow::moveCursorToCenter()
// Update UI based on stored mouse position from mouse-move
// event processing.
-BOOL LLViewerWindow::handlePerFrameHover()
+void LLViewerWindow::updateUI()
{
static std::string last_handle_msg;
+ updateWorldViewRect();
+
LLView::sMouseHandlerMessage.clear();
S32 x = mCurrentMousePoint.mX;
S32 y = mCurrentMousePoint.mY;
MASK mask = gKeyboard->currentMask(TRUE);
- //RN: fix for asynchronous notification of mouse leaving window not working
- LLCoordWindow mouse_pos;
- mWindow->getCursorPosition(&mouse_pos);
- if (mouse_pos.mX < 0 ||
- mouse_pos.mY < 0 ||
- mouse_pos.mX > mWindowRect.getWidth() ||
- mouse_pos.mY > mWindowRect.getHeight())
- {
- mMouseInWindow = FALSE;
- }
- else
+ if (gNoRender)
{
- mMouseInWindow = TRUE;
+ return;
}
+ updateMouseDelta();
+ updateKeyboardFocus();
- S32 dx = lltrunc((F32) (mCurrentMousePoint.mX - mLastMousePoint.mX) * LLUI::sGLScaleFactor.mV[VX]);
- S32 dy = lltrunc((F32) (mCurrentMousePoint.mY - mLastMousePoint.mY) * LLUI::sGLScaleFactor.mV[VY]);
-
- LLVector2 mouse_vel;
+ BOOL handled = FALSE;
- if (gSavedSettings.getBOOL("MouseSmooth"))
- {
- static F32 fdx = 0.f;
- static F32 fdy = 0.f;
+ BOOL handled_by_top_ctrl = FALSE;
+ LLUICtrl* top_ctrl = gFocusMgr.getTopCtrl();
+ LLMouseHandler* mouse_captor = gFocusMgr.getMouseCapture();
- F32 amount = 16.f;
- fdx = fdx + ((F32) dx - fdx) * llmin(gFrameIntervalSeconds*amount,1.f);
- fdy = fdy + ((F32) dy - fdy) * llmin(gFrameIntervalSeconds*amount,1.f);
+ //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;
- mCurrentMouseDelta.set(llround(fdx), llround(fdy));
- mouse_vel.setVec(fdx,fdy);
- }
- else
+ // start at current mouse captor (if is a view) or UI root
+ LLView* root_view = NULL;
+ root_view = dynamic_cast<LLView*>(mouse_captor);
+ if (!root_view)
{
- mCurrentMouseDelta.set(dx, dy);
- mouse_vel.setVec((F32) dx, (F32) dy);
+ root_view = mRootView;
}
-
- mMouseVelocityStat.addValue(mouse_vel.magVec());
- if (gNoRender)
+ // aggregate visible views that contain mouse cursor in display order
+
+ // 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))
{
- return TRUE;
+ // iterator over contents of top_ctrl, and throw into mouse_hover_set
+ for (LLView::tree_iterator_t it = top_ctrl->beginTree();
+ it != top_ctrl->endTree();
+ ++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();
+ }
+ }
}
-
- // clean up current focus
- LLUICtrl* cur_focus = gFocusMgr.getKeyboardFocus();
- if (cur_focus)
+ else
{
- if (!cur_focus->isInVisibleChain() || !cur_focus->isInEnabledChain())
+ // 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)
{
- gFocusMgr.releaseFocusIfNeeded(cur_focus);
-
- LLUICtrl* parent = cur_focus->getParentUICtrl();
- const LLUICtrl* focus_root = cur_focus->findRootMostFocusRoot();
- while(parent)
+ 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))
{
- if (parent->isCtrl() &&
- (parent->hasTabStop() || parent == focus_root) &&
- !parent->getIsChrome() &&
- parent->isInVisibleChain() &&
- parent->isInEnabledChain())
+
+ // if this view is mouse opaque, nothing behind it should be in mouse_hover_set
+ if (viewp->getMouseOpaque())
{
- if (!parent->focusFirstItem())
- {
- parent->setFocus(TRUE);
- }
- break;
+ // constrain further iteration to children of this widget
+ it = viewp->beginTree();
}
- parent = parent->getParentUICtrl();
+
+ // 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 if (cur_focus->isFocusRoot())
+ }
+
+ typedef std::vector<LLHandle<LLView> > view_handle_list_t;
+
+ // call onMouseEnter() on all views which contain the mouse cursor but did not before
+ view_handle_list_t mouse_enter_views;
+ std::set_difference(mouse_hover_set.begin(), mouse_hover_set.end(),
+ mMouseHoverViews.begin(), mMouseHoverViews.end(),
+ std::back_inserter(mouse_enter_views));
+ for (view_handle_list_t::iterator it = mouse_enter_views.begin();
+ it != mouse_enter_views.end();
+ ++it)
+ {
+ LLView* viewp = it->get();
+ if (viewp)
{
- // focus roots keep trying to delegate focus to their first valid descendant
- // this assumes that focus roots are not valid focus holders on their own
- cur_focus->focusFirstItem();
+ LLRect view_screen_rect = viewp->calcScreenRect();
+ viewp->onMouseEnter(x - view_screen_rect.mLeft, y - view_screen_rect.mBottom, mask);
}
}
- BOOL handled = FALSE;
+ // call onMouseLeave() on all views which no longer contain the mouse cursor
+ view_handle_list_t mouse_leave_views;
+ std::set_difference(mMouseHoverViews.begin(), mMouseHoverViews.end(),
+ mouse_hover_set.begin(), mouse_hover_set.end(),
+ std::back_inserter(mouse_leave_views));
+ for (view_handle_list_t::iterator it = mouse_leave_views.begin();
+ it != mouse_leave_views.end();
+ ++it)
+ {
+ LLView* viewp = it->get();
+ if (viewp)
+ {
+ LLRect view_screen_rect = viewp->calcScreenRect();
+ viewp->onMouseLeave(x - view_screen_rect.mLeft, y - view_screen_rect.mBottom, mask);
+ }
+ }
- BOOL handled_by_top_ctrl = FALSE;
- LLUICtrl* top_ctrl = gFocusMgr.getTopCtrl();
+ // store resulting hover set for next frame
+ swap(mMouseHoverViews, mouse_hover_set);
- LLMouseHandler* mouse_captor = gFocusMgr.getMouseCapture();
if( mouse_captor )
{
// Pass hover events to object capturing mouse events.
@@ -2691,115 +2666,195 @@ BOOL LLViewerWindow::handlePerFrameHover()
}
}
- if (tool && tool != gToolNull && tool != LLToolCompInspect::getInstance() && tool != LLToolDragAndDrop::getInstance() && !gSavedSettings.getBOOL("FreezeTime"))
+ updateLayout();
+
+ mLastMousePoint = mCurrentMousePoint;
+
+ // cleanup unused selections when no modal dialogs are open
+ if (LLModalDialog::activeCount() == 0)
+ {
+ LLViewerParcelMgr::getInstance()->deselectUnused();
+ }
+
+ if (LLModalDialog::activeCount() == 0)
+ {
+ 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()
+{
+ LLTool* tool = LLToolMgr::getInstance()->getCurrentTool();
+ if (gFloaterTools != NULL
+ && tool != NULL
+ && tool != gToolNull
+ && tool != LLToolCompInspect::getInstance()
+ && tool != LLToolDragAndDrop::getInstance()
+ && !gSavedSettings.getBOOL("FreezeTime"))
{
LLMouseHandler *captor = gFocusMgr.getMouseCapture();
// With the null, inspect, or drag and drop tool, don't muck
// with visibility.
- if (gFloaterTools->isMinimized() ||
- (tool != LLToolPie::getInstance() // not default tool
- && tool != LLToolCompGun::getInstance() // not coming out of mouselook
- && !mSuppressToolbox // not override in third person
- && LLToolMgr::getInstance()->getCurrentToolset() != gFaceEditToolset // not special mode
- && LLToolMgr::getInstance()->getCurrentToolset() != gMouselookToolset
- && (!captor || captor->isView())) // not dragging
- )
+ if (gFloaterTools->isMinimized()
+ || (tool != LLToolPie::getInstance() // not default tool
+ && tool != LLToolCompGun::getInstance() // not coming out of mouselook
+ && !mSuppressToolbox // not override in third person
+ && LLToolMgr::getInstance()->getCurrentToolset() != gFaceEditToolset // not special mode
+ && LLToolMgr::getInstance()->getCurrentToolset() != gMouselookToolset
+ && (!captor || captor->isView()))) // not dragging
{
// Force floater tools to be visible (unless minimized)
if (!gFloaterTools->getVisible())
{
- gFloaterTools->open(); /* Flawfinder: ignore */
+ gFloaterTools->openFloater();
}
// Update the location of the blue box tool popup
LLCoordGL select_center_screen;
- gFloaterTools->updatePopup( select_center_screen, mask );
+ gFloaterTools->updatePopup( select_center_screen, gKeyboard->currentMask(TRUE) );
}
else
{
gFloaterTools->setVisible(FALSE);
}
- // In the future we may wish to hide the tools menu unless you
- // are building. JC
- //gMenuBarView->setItemVisible("Tools", gFloaterTools->getVisible());
- //gMenuBarView->arrange();
- }
- if (gToolBar)
- {
- gToolBar->refresh();
+ gMenuBarView->setItemVisible("BuildTools", gFloaterTools->getVisible());
}
+}
- if (gChatBar)
+void LLViewerWindow::updateMouseDelta()
+{
+ S32 dx = lltrunc((F32) (mCurrentMousePoint.mX - mLastMousePoint.mX) * LLUI::sGLScaleFactor.mV[VX]);
+ S32 dy = lltrunc((F32) (mCurrentMousePoint.mY - mLastMousePoint.mY) * LLUI::sGLScaleFactor.mV[VY]);
+
+ //RN: fix for asynchronous notification of mouse leaving window not working
+ LLCoordWindow mouse_pos;
+ mWindow->getCursorPosition(&mouse_pos);
+ if (mouse_pos.mX < 0 ||
+ mouse_pos.mY < 0 ||
+ mouse_pos.mX > mWindowRect.getWidth() ||
+ mouse_pos.mY > mWindowRect.getHeight())
{
- gChatBar->refresh();
+ mMouseInWindow = FALSE;
}
-
- if (gOverlayBar)
+ else
{
- gOverlayBar->refresh();
+ mMouseInWindow = TRUE;
}
- // Update rectangles for the various toolbars
- if (gOverlayBar && gNotifyBoxView && gConsole && gToolBar)
+ LLVector2 mouse_vel;
+
+ if (gSavedSettings.getBOOL("MouseSmooth"))
{
- LLRect bar_rect(-1, STATUS_BAR_HEIGHT, getWindowWidth()+1, -1);
+ static F32 fdx = 0.f;
+ static F32 fdy = 0.f;
- LLRect notify_box_rect = gNotifyBoxView->getRect();
- notify_box_rect.mBottom = bar_rect.mBottom;
- gNotifyBoxView->reshape(notify_box_rect.getWidth(), notify_box_rect.getHeight());
- gNotifyBoxView->setRect(notify_box_rect);
+ F32 amount = 16.f;
+ fdx = fdx + ((F32) dx - fdx) * llmin(gFrameIntervalSeconds*amount,1.f);
+ fdy = fdy + ((F32) dy - fdy) * llmin(gFrameIntervalSeconds*amount,1.f);
- // make sure floaters snap to visible rect by adjusting floater view rect
- LLRect floater_rect = gFloaterView->getRect();
- if (floater_rect.mBottom != bar_rect.mBottom+1)
- {
- floater_rect.mBottom = bar_rect.mBottom+1;
- // Don't bounce the floaters up and down.
- gFloaterView->reshapeFloater(floater_rect.getWidth(), floater_rect.getHeight(),
- TRUE, ADJUST_VERTICAL_NO);
- gFloaterView->setRect(floater_rect);
- }
+ mCurrentMouseDelta.set(llround(fdx), llround(fdy));
+ mouse_vel.setVec(fdx,fdy);
+ }
+ else
+ {
+ mCurrentMouseDelta.set(dx, dy);
+ mouse_vel.setVec((F32) dx, (F32) dy);
+ }
+
+ mMouseVelocityStat.addValue(mouse_vel.magVec());
+}
- // snap floaters to top of chat bar/button strip
- LLView* chatbar_and_buttons = gOverlayBar->getChild<LLView>("chatbar_and_buttons", TRUE);
- // find top of chatbar and state buttons, if either are visible
- if (chatbar_and_buttons && !chatbar_and_buttons->getLocalBoundingRect().isNull())
- {
- // convert top/left corner of chatbar/buttons container to gFloaterView-relative coordinates
- S32 top, left;
- chatbar_and_buttons->localPointToOtherView(
- chatbar_and_buttons->getLocalBoundingRect().mLeft,
- chatbar_and_buttons->getLocalBoundingRect().mTop,
- &left,
- &top,
- gFloaterView);
- gFloaterView->setSnapOffsetBottom(top);
- }
- else if (gToolBar->getVisible())
+void LLViewerWindow::updateKeyboardFocus()
+{
+ // clean up current focus
+ LLUICtrl* cur_focus = gFocusMgr.getKeyboardFocus();
+ if (cur_focus)
+ {
+ if (!cur_focus->isInVisibleChain() || !cur_focus->isInEnabledChain())
{
- S32 top, left;
- gToolBar->localPointToOtherView(
- gToolBar->getLocalBoundingRect().mLeft,
- gToolBar->getLocalBoundingRect().mTop,
- &left,
- &top,
- gFloaterView);
- gFloaterView->setSnapOffsetBottom(top);
+ gFocusMgr.releaseFocusIfNeeded(cur_focus);
+
+ LLUICtrl* parent = cur_focus->getParentUICtrl();
+ const LLUICtrl* focus_root = cur_focus->findRootMostFocusRoot();
+ while(parent)
+ {
+ if (parent->isCtrl() &&
+ (parent->hasTabStop() || parent == focus_root) &&
+ !parent->getIsChrome() &&
+ parent->isInVisibleChain() &&
+ parent->isInEnabledChain())
+ {
+ if (!parent->focusFirstItem())
+ {
+ parent->setFocus(TRUE);
+ }
+ break;
+ }
+ parent = parent->getParentUICtrl();
+ }
}
- else
+ else if (cur_focus->isFocusRoot())
{
- gFloaterView->setSnapOffsetBottom(0);
+ // focus roots keep trying to delegate focus to their first valid descendant
+ // this assumes that focus roots are not valid focus holders on their own
+ cur_focus->focusFirstItem();
}
-
- // Always update console
- LLRect console_rect = getChatConsoleRect();
- console_rect.mBottom = gHUDView->getRect().mBottom + getChatConsoleBottomPad();
- gConsole->reshape(console_rect.getWidth(), console_rect.getHeight());
- gConsole->setRect(console_rect);
}
- mLastMousePoint = mCurrentMousePoint;
-
// last ditch force of edit menu to selection manager
if (LLEditMenuHandler::gEditMenuHandler == NULL && LLSelectMgr::getInstance()->getSelection()->getObjectCount())
{
@@ -2832,6 +2887,10 @@ BOOL LLViewerWindow::handlePerFrameHover()
gFloaterView->syncFloaterTabOrder();
}
+ if(LLSideTray::instanceCreated())//just getInstance will create sidetray. we don't want this
+ LLSideTray::getInstance()->highlightFocused();
+
+
if (gSavedSettings.getBOOL("ChatBarStealsFocus")
&& gChatBar
&& gFocusMgr.getKeyboardFocus() == NULL
@@ -2840,70 +2899,42 @@ BOOL LLViewerWindow::handlePerFrameHover()
gChatBar->startChat(NULL);
}
- // cleanup unused selections when no modal dialogs are open
- if (LLModalDialog::activeCount() == 0)
- {
- LLViewerParcelMgr::getInstance()->deselectUnused();
- }
-
- if (LLModalDialog::activeCount() == 0)
- {
- LLSelectMgr::getInstance()->deselectUnused();
- }
-
- if (gPipeline.hasRenderDebugMask(LLPipeline::RENDER_DEBUG_RAYCAST))
- {
- gDebugRaycastFaceHit = -1;
- gDebugRaycastObject = cursorIntersect(-1, -1, 512.f, NULL, -1, FALSE,
- &gDebugRaycastFaceHit,
- &gDebugRaycastIntersection,
- &gDebugRaycastTexCoord,
- &gDebugRaycastNormal,
- &gDebugRaycastBinormal);
- }
-
- // 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 ((previous_x != x) || (previous_y != y))
- mouse_moved_since_pick = TRUE;
+}
- BOOL do_pick = FALSE;
+void LLViewerWindow::updateWorldViewRect()
+{
+ if (!LLSideTray::instanceCreated()) return;
- F32 picks_moving = gSavedSettings.getF32("PicksPerSecondMouseMoving");
- if ((mouse_moved_since_pick) && (picks_moving > 0.0) && (mPickTimer.getElapsedTimeF32() > 1.0f / picks_moving))
- {
- do_pick = TRUE;
- }
+ LLRect new_world_rect = mWindowRect;
- F32 picks_stationary = gSavedSettings.getF32("PicksPerSecondMouseStationary");
- if ((!mouse_moved_since_pick) && (picks_stationary > 0.0) && (mPickTimer.getElapsedTimeF32() > 1.0f / picks_stationary))
+ // pull in right side of world view based on sidetray
+ LLSideTray* sidetray = LLSideTray::getInstance();
+ if (sidetray->getVisible())
{
- do_pick = TRUE;
+ new_world_rect.mRight -= llround((F32)sidetray->getTrayWidth() * mDisplayScale.mV[VX]);
}
- if (getCursorHidden())
+ // push top of world view below nav bar
+ if (LLNavigationBar::getInstance()->getVisible())
{
- do_pick = FALSE;
+ LLNavigationBar* barp = LLNavigationBar::getInstance();
+ LLRect nav_bar_rect;
+ if(barp->localRectToOtherView(barp->getLocalRect(), &nav_bar_rect, mRootView))
+ {
+ new_world_rect.mTop = llround((F32)LLNavigationBar::getInstance()->getRect().mBottom * mDisplayScale.mV[VY]);
+ }
}
- if (do_pick)
+ if (mWorldViewRect != new_world_rect)
{
- mouse_moved_since_pick = FALSE;
- mPickTimer.reset();
- pickAsync(getCurrentMouseX(), getCurrentMouseY(), mask, hoverPickCallback, TRUE);
+ mWorldViewRect = new_world_rect;
+ gResizeScreenTexture = TRUE;
+ LLViewerCamera::getInstance()->setViewHeightInPixels( mWorldViewRect.getHeight() );
+ LLViewerCamera::getInstance()->setAspect( getWorldViewAspectRatio() );
}
-
- previous_x = x;
- previous_y = y;
-
- return handled;
}
-
/* static */
void LLViewerWindow::hoverPickCallback(const LLPickInfo& pick_info)
{
@@ -3164,7 +3195,7 @@ void LLViewerWindow::pickAsync(S32 x, S32 y_from_bot, MASK mask, void (*callback
}
// push back pick info object
- BOOL in_build_mode = gFloaterTools && gFloaterTools->getVisible();
+ BOOL in_build_mode = LLFloaterReg::instanceVisible("build");
if (in_build_mode || LLDrawPoolAlpha::sShowDebugAlpha)
{
// build mode allows interaction with all transparent objects
@@ -3179,10 +3210,10 @@ void LLViewerWindow::pickAsync(S32 x, S32 y_from_bot, MASK mask, void (*callback
{
mPickScreenRegion.setCenterAndSize(x, y_from_bot, PICK_DIAMETER, PICK_DIAMETER);
- if (mPickScreenRegion.mLeft < 0) mPickScreenRegion.translate(-mPickScreenRegion.mLeft, 0);
- if (mPickScreenRegion.mBottom < 0) mPickScreenRegion.translate(0, -mPickScreenRegion.mBottom);
- if (mPickScreenRegion.mRight > mWindowRect.getWidth() ) mPickScreenRegion.translate(mWindowRect.getWidth() - mPickScreenRegion.mRight, 0);
- if (mPickScreenRegion.mTop > mWindowRect.getHeight() ) mPickScreenRegion.translate(0, mWindowRect.getHeight() - mPickScreenRegion.mTop);
+ 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
@@ -3210,77 +3241,6 @@ void LLViewerWindow::schedulePick(LLPickInfo& pick_info)
llassert_always(pick_info.mScreenRegion.notNull());
mPicks.push_back(pick_info);
- /*S32 scaled_x = llround((F32)pick_info.mMousePt.mX * mDisplayScale.mV[VX]);
- S32 scaled_y = llround((F32)pick_info.mMousePt.mY * mDisplayScale.mV[VY]);
-
- // Default to not hitting anything
- LLCamera pick_camera;
- pick_camera.setOrigin(LLViewerCamera::getInstance()->getOrigin());
- pick_camera.setOriginAndLookAt(LLViewerCamera::getInstance()->getOrigin(),
- LLViewerCamera::getInstance()->getUpAxis(),
- LLViewerCamera::getInstance()->getOrigin() + mouseDirectionGlobal(pick_info.mMousePt.mX, pick_info.mMousePt.mY));
- pick_camera.setView(0.5f*DEG_TO_RAD);
- pick_camera.setNear(LLViewerCamera::getInstance()->getNear());
- pick_camera.setFar(LLViewerCamera::getInstance()->getFar());
- pick_camera.setAspect(1.f);
-
- // save our drawing state
- // *TODO: should we be saving using the new method here using
- // glh_get_current_projection/glh_set_current_projection? -brad
- glMatrixMode(GL_MODELVIEW);
- glPushMatrix();
- glLoadIdentity();
-
- glMatrixMode(GL_PROJECTION);
- glPushMatrix();
- glLoadIdentity();
-
- // clear work area
- {
- LLGLState scissor_state(GL_SCISSOR_TEST);
- scissor_state.enable();
- glScissor(pick_info.mScreenRegion.mLeft, pick_info.mScreenRegion.mBottom, pick_info.mScreenRegion.getWidth(), pick_info.mScreenRegion.getHeight());
- glClearColor(0.f, 0.f, 0.f, 0.f);
- glClear(GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);
- //glClear(GL_COLOR_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);
- }
-
- // build perspective transform and picking viewport
- // Perform pick on a PICK_DIAMETER x PICK_DIAMETER pixel region around cursor point.
- // Don't limit the select distance for this pick.
- LLViewerCamera::getInstance()->setPerspective(FOR_SELECTION, scaled_x - PICK_HALF_WIDTH, scaled_y - PICK_HALF_WIDTH, PICK_DIAMETER, PICK_DIAMETER, FALSE);
-
- // render for object picking
-
- // make viewport big enough to handle antialiased frame buffers
- gGLViewport[0] = pick_info.mScreenRegion.mLeft;
- gGLViewport[1] = pick_info.mScreenRegion.mBottom;
- gGLViewport[2] = pick_info.mScreenRegion.getWidth();
- gGLViewport[3] = pick_info.mScreenRegion.getHeight();
-
- glViewport(gGLViewport[0], gGLViewport[1], gGLViewport[2], gGLViewport[3]);
- LLViewerCamera::updateFrustumPlanes(pick_camera);
- stop_glerror();
-
- // Draw the objects so the user can select them.
- // The starting ID is 1, since land is zero.
- LLRect pick_region;
- pick_region.setOriginAndSize(pick_info.mMousePt.mX - PICK_HALF_WIDTH,
- pick_info.mMousePt.mY - PICK_HALF_WIDTH, PICK_DIAMETER, PICK_DIAMETER);
- gObjectList.renderObjectsForSelect(pick_camera, pick_region, FALSE, pick_info.mPickTransparent);
-
- stop_glerror();
-
- // restore drawing state
- glMatrixMode(GL_PROJECTION);
- glPopMatrix();
- glMatrixMode(GL_MODELVIEW);
- glPopMatrix();
-
- setup3DRender();
- setup2DRender();
- setupViewport();*/
-
// delay further event processing until we receive results of pick
mWindow->delayInputProcessing();
}
@@ -3449,16 +3409,16 @@ LLVector3 LLViewerWindow::mouseDirectionGlobal(const S32 x, const S32 y) const
// find vertical field of view
F32 fov = LLViewerCamera::getInstance()->getView();
- // find screen resolution
- S32 height = getWindowHeight();
- S32 width = getWindowWidth();
+ // find world view center
+ F32 center_x = (F32)getWorldViewRect().getCenterX();
+ F32 center_y = (F32)getWorldViewRect().getCenterY();
// calculate pixel distance to screen
- F32 distance = (height / 2.f) / (tan(fov / 2.f));
+ F32 distance = (getWorldViewHeight() / 2.f) / (tan(fov / 2.f));
// calculate click point relative to middle of screen
- F32 click_x = x - width / 2.f;
- F32 click_y = y - height / 2.f;
+ F32 click_x = x - center_x;
+ F32 click_y = y - center_y;
// compute mouse vector
LLVector3 mouse_vector = distance * LLViewerCamera::getInstance()->getAtAxis()
@@ -3473,12 +3433,15 @@ 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 = getWindowHeight();
- S32 width = getWindowWidth();
+ S32 height = getWorldViewHeight();
+
+ // find world view center
+ F32 center_x = (F32)getWorldViewRect().getCenterX();
+ F32 center_y = (F32)getWorldViewRect().getCenterY();
// remap with uniform scale (1/height) so that top is -0.5, bottom is +0.5
- F32 hud_x = -((F32)x - (F32)width/2.f) / height;
- F32 hud_y = ((F32)y - (F32)height/2.f) / height;
+ 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);
}
@@ -3492,12 +3455,16 @@ LLVector3 LLViewerWindow::mouseDirectionCamera(const S32 x, const S32 y) const
F32 fov_width = fov_height * LLViewerCamera::getInstance()->getAspect();
// find screen resolution
- S32 height = getWindowHeight();
- S32 width = getWindowWidth();
+ S32 height = getWorldViewHeight();
+ S32 width = getWorldViewWidth();
+
+ // find world view center
+ F32 center_x = (F32)getWorldViewRect().getCenterX();
+ F32 center_y = (F32)getWorldViewRect().getCenterY();
// calculate click point relative to middle of screen
- F32 click_x = (((F32)x / (F32)width) - 0.5f) * fov_width * -1.f;
- F32 click_y = (((F32)y / (F32)height) - 0.5f) * fov_height;
+ F32 click_x = (((F32)x - center_x) / (F32)width) * fov_width * -1.f;
+ F32 click_y = (((F32)y - center_y) / (F32)height) * fov_height;
// compute mouse vector
LLVector3 mouse_vector = LLVector3(0.f, 0.f, -1.f);
@@ -3841,7 +3808,6 @@ BOOL LLViewerWindow::thumbnailSnapshot(LLImageRaw *raw, S32 preview_width, S32 p
glClearColor(0.f, 0.f, 0.f, 0.f);
glClear(GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);
setup3DRender();
- setupViewport();
LLFontGL::setFontDisplay(FALSE) ;
LLHUDText::setDisplayText(FALSE) ;
@@ -3902,7 +3868,6 @@ BOOL LLViewerWindow::thumbnailSnapshot(LLImageRaw *raw, S32 preview_width, S32 p
mDisplayScale.setVec(display_scale) ;
mWindowRect = window_rect;
setup3DRender();
- setupViewport();
gDisplaySwapBuffers = FALSE;
gDepthDirty = TRUE;
@@ -4070,7 +4035,6 @@ BOOL LLViewerWindow::rawSnapshot(LLImageRaw *raw, S32 image_width, S32 image_hei
LLViewerCamera::getInstance()->setZoomParameters(scale_factor, subimage_x+(subimage_y*llceil(scale_factor)));
setup3DRender();
- setupViewport();
gObjectList.renderPickList(gViewerWindow->getVirtualWindowRect(), FALSE, FALSE);
}
else
@@ -4215,14 +4179,14 @@ void LLViewerWindow::destroyWindow()
void LLViewerWindow::drawMouselookInstructions()
{
// Draw instructions for mouselook ("Press ESC to leave Mouselook" in a box at the top of the screen.)
- const std::string instructions = "Press ESC to leave Mouselook.";
- const LLFontGL* font = LLResMgr::getInstance()->getRes( LLFONT_SANSSERIF );
+ const std::string instructions = LLTrans::getString("LeaveMouselook");
+ const LLFontGL* font = LLFontGL::getFontSansSerif();
const S32 INSTRUCTIONS_PAD = 5;
LLRect instructions_rect;
instructions_rect.setLeftTopAndSize(
- INSTRUCTIONS_PAD,
- getWindowHeight() - INSTRUCTIONS_PAD,
+ mWorldViewRect.mLeft + INSTRUCTIONS_PAD,
+ mWorldViewRect.mTop - INSTRUCTIONS_PAD,
font->getWidth( instructions ) + 2 * INSTRUCTIONS_PAD,
llround(font->getLineHeight() + 2 * INSTRUCTIONS_PAD));
@@ -4251,6 +4215,46 @@ S32 LLViewerWindow::getWindowWidth() const
return mVirtualWindowRect.getWidth();
}
+void* LLViewerWindow::getPlatformWindow() const
+{
+ return mWindow->getPlatformWindow();
+}
+
+void* LLViewerWindow::getMediaWindow() const
+{
+ return mWindow->getMediaWindow();
+}
+
+void LLViewerWindow::focusClient() const
+{
+ return mWindow->focusClient();
+}
+
+LLRootView* LLViewerWindow::getRootView() const
+{
+ return mRootView;
+}
+
+LLRect LLViewerWindow::getVirtualWorldViewRect() 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;
+}
+
+S32 LLViewerWindow::getWorldViewHeight() const
+{
+ return mWorldViewRect.getHeight();
+}
+
+S32 LLViewerWindow::getWorldViewWidth() const
+{
+ return mWorldViewRect.getWidth();
+}
+
S32 LLViewerWindow::getWindowDisplayHeight() const
{
return mWindowRect.getHeight();
@@ -4261,27 +4265,48 @@ S32 LLViewerWindow::getWindowDisplayWidth() const
return mWindowRect.getWidth();
}
-void LLViewerWindow::setupViewport(S32 x_offset, S32 y_offset)
+void LLViewerWindow::setup2DRender()
+{
+ // setup ortho camera
+ gl_state_for_2d(mWindowRect.getWidth(), mWindowRect.getHeight());
+ setup2DViewport();
+}
+
+void LLViewerWindow::setup2DViewport(S32 x_offset, S32 y_offset)
{
- gGLViewport[0] = x_offset;
- gGLViewport[1] = y_offset;
+ gGLViewport[0] = mWindowRect.mLeft + x_offset;
+ gGLViewport[1] = mWindowRect.mBottom + y_offset;
gGLViewport[2] = mWindowRect.getWidth();
gGLViewport[3] = mWindowRect.getHeight();
glViewport(gGLViewport[0], gGLViewport[1], gGLViewport[2], gGLViewport[3]);
}
+
void LLViewerWindow::setup3DRender()
{
- LLViewerCamera::getInstance()->setPerspective(NOT_FOR_SELECTION, 0, 0, mWindowRect.getWidth(), mWindowRect.getHeight(), FALSE, LLViewerCamera::getInstance()->getNear(), MAX_FAR_CLIP*2.f);
+ // 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);
+ setup3DViewport();
}
-void LLViewerWindow::setup2DRender()
+void LLViewerWindow::setup3DViewport(S32 x_offset, S32 y_offset)
{
- gl_state_for_2d(mWindowRect.getWidth(), mWindowRect.getHeight());
+ if (LLRenderTarget::getCurrentBoundTarget() != NULL)
+ {
+ // don't use translation component of mWorldViewRect, 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[2] = mWorldViewRect.getWidth();
+ gGLViewport[3] = mWorldViewRect.getHeight();
+ glViewport(gGLViewport[0], gGLViewport[1], gGLViewport[2], gGLViewport[3]);
}
-
-
void LLViewerWindow::setShowProgress(const BOOL show)
{
if (mProgressView)
@@ -4295,6 +4320,10 @@ BOOL LLViewerWindow::getShowProgress() const
return (mProgressView && mProgressView->getVisible());
}
+void LLViewerWindow::handleLoginComplete()
+{
+ LLNavigationBar::getInstance()->handleLoginComplete();
+}
void LLViewerWindow::moveProgressViewToFront()
{
@@ -4463,12 +4492,16 @@ void LLViewerWindow::restoreGL(const std::string& progress_message)
void LLViewerWindow::initFonts(F32 zoom_factor)
{
LLFontGL::destroyAllGL();
- LLFontGL::initDefaultFonts( gSavedSettings.getF32("FontScreenDPI"),
+ // Initialize with possibly different zoom factor
+ LLFontGL::initClass( gSavedSettings.getF32("FontScreenDPI"),
mDisplayScale.mV[VX] * zoom_factor,
mDisplayScale.mV[VY] * zoom_factor,
gDirUtilp->getAppRODataDir(),
- LLUICtrlFactory::getXUIPaths());
+ LLUI::getXUIPaths());
+ // Force font reloads, which can be very slow
+ LLFontGL::loadDefaultFonts();
}
+
void LLViewerWindow::toggleFullscreen(BOOL show_progress)
{
if (mWindow)
@@ -4501,6 +4534,11 @@ void LLViewerWindow::getTargetWindow(BOOL& fullscreen, S32& width, S32& height)
}
}
+void LLViewerWindow::requestResolutionUpdate()
+{
+ mResDirty = true;
+}
+
void LLViewerWindow::requestResolutionUpdate(bool fullscreen_checked)
{
mResDirty = true;
@@ -4534,7 +4572,7 @@ BOOL LLViewerWindow::checkSettings()
// force aspect ratio
if (mIsFullscreenChecked)
{
- LLViewerCamera::getInstance()->setAspect( getDisplayAspectRatio() );
+ LLViewerCamera::getInstance()->setAspect( getWorldViewAspectRatio() );
}
mResDirty = false;
@@ -4605,9 +4643,9 @@ BOOL LLViewerWindow::changeDisplaySettings(BOOL fullscreen, LLCoordScreen size,
BOOL was_maximized = gSavedSettings.getBOOL("WindowMaximized");
mWantFullscreen = fullscreen;
mShowFullscreenProgress = show_progress_bar;
- gSavedSettings.setBOOL("FullScreen", mWantFullscreen);
+ gSavedSettings.setBOOL("NotFullScreen", !mWantFullscreen);
- gResizeScreenTexture = TRUE;
+ //gResizeScreenTexture = TRUE;
BOOL old_fullscreen = mWindow->getFullscreen();
if (!old_fullscreen && fullscreen && !LLStartUp::canGoFullscreen())
@@ -4635,7 +4673,7 @@ BOOL LLViewerWindow::changeDisplaySettings(BOOL fullscreen, LLCoordScreen size,
}
// Close floaters that don't handle settings change
- LLFloaterSnapshot::hide(0);
+ LLFloaterReg::hideInstance("snapshot");
BOOL result_first_try = FALSE;
BOOL result_second_try = FALSE;
@@ -4753,6 +4791,21 @@ F32 LLViewerWindow::getDisplayAspectRatio() const
}
+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();
@@ -4795,6 +4848,8 @@ void LLViewerWindow::calcDisplayScale()
}
}
+S32 TOOL_BAR_HEIGHT = 20; // *TODO:Skinning Fix
+
S32 LLViewerWindow::getChatConsoleBottomPad()
{
S32 offset = 0;
@@ -4857,63 +4912,6 @@ bool LLViewerWindow::onAlert(const LLSD& notify)
}
////////////////////////////////////////////////////////////////////////////
-
-LLBottomPanel::LLBottomPanel(const LLRect &rect) :
- LLPanel(LLStringUtil::null, rect, FALSE),
- mIndicator(NULL)
-{
- // bottom panel is focus root, so Tab moves through the toolbar and button bar, and overlay
- setFocusRoot(TRUE);
- // flag this panel as chrome so buttons don't grab keyboard focus
- setIsChrome(TRUE);
-
- mFactoryMap["toolbar"] = LLCallbackMap(createToolBar, NULL);
- mFactoryMap["overlay"] = LLCallbackMap(createOverlayBar, NULL);
- mFactoryMap["hud"] = LLCallbackMap(createHUD, NULL);
- LLUICtrlFactory::getInstance()->buildPanel(this, "panel_bars.xml", &getFactoryMap());
-
- setOrigin(rect.mLeft, rect.mBottom);
- reshape(rect.getWidth(), rect.getHeight());
-}
-
-void LLBottomPanel::setFocusIndicator(LLView * indicator)
-{
- mIndicator = indicator;
-}
-
-void LLBottomPanel::draw()
-{
- if(mIndicator)
- {
- BOOL hasFocus = gFocusMgr.childHasKeyboardFocus(this);
- mIndicator->setVisible(hasFocus);
- mIndicator->setEnabled(hasFocus);
- }
- LLPanel::draw();
-}
-
-void* LLBottomPanel::createHUD(void* data)
-{
- delete gHUDView;
- gHUDView = new LLHUDView();
- return gHUDView;
-}
-
-
-void* LLBottomPanel::createOverlayBar(void* data)
-{
- delete gOverlayBar;
- gOverlayBar = new LLOverlayBar();
- return gOverlayBar;
-}
-
-void* LLBottomPanel::createToolBar(void* data)
-{
- delete gToolBar;
- gToolBar = new LLToolBar();
- return gToolBar;
-}
-
//
// LLPickInfo
//
@@ -4985,8 +4983,8 @@ void LLPickInfo::fetchResults()
// 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->getWindowDisplayWidth() - PICK_HALF_WIDTH);
- scaled_pick_point.mY = llclamp(llround((F32)mMousePt.mY * gViewerWindow->getDisplayScale().mV[VY]), PICK_HALF_WIDTH, gViewerWindow->getWindowDisplayHeight() - PICK_HALF_WIDTH);
+ 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];