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.cpp110
1 files changed, 66 insertions, 44 deletions
diff --git a/indra/newview/llviewerwindow.cpp b/indra/newview/llviewerwindow.cpp
index d399cc6469..2b02d5165f 100644
--- a/indra/newview/llviewerwindow.cpp
+++ b/indra/newview/llviewerwindow.cpp
@@ -66,6 +66,7 @@
#include "llchatentry.h"
#include "indra_constants.h"
#include "llassetstorage.h"
+#include "lldate.h"
#include "llerrorcontrol.h"
#include "llfontgl.h"
#include "llmousehandler.h"
@@ -79,14 +80,12 @@
#include "message.h"
#include "object_flags.h"
#include "lltimer.h"
-#include "llviewermenu.h"
#include "lltooltip.h"
#include "llmediaentry.h"
#include "llurldispatcher.h"
#include "raytrace.h"
// newview includes
-#include "llagent.h"
#include "llbox.h"
#include "llchicletbar.h"
#include "llconsole.h"
@@ -118,7 +117,6 @@
#include "llfontfreetype.h"
#include "llgesturemgr.h"
#include "llglheaders.h"
-#include "lltooltip.h"
#include "llhudmanager.h"
#include "llhudobject.h"
#include "llhudview.h"
@@ -133,7 +131,6 @@
#include "llmorphview.h"
#include "llmoveview.h"
#include "llnavigationbar.h"
-#include "llnotificationhandler.h"
#include "llpaneltopinfobar.h"
#include "llpopupview.h"
#include "llpreviewtexture.h"
@@ -166,17 +163,13 @@
#include "lltoolselectland.h"
#include "lltrans.h"
#include "lluictrlfactory.h"
-#include "llurldispatcher.h" // SLURL from other app instance
#include "llversioninfo.h"
#include "llvieweraudio.h"
-#include "llviewercamera.h"
#include "llviewergesture.h"
#include "llviewertexturelist.h"
#include "llviewerinventory.h"
-#include "llviewerinput.h"
#include "llviewermedia.h"
#include "llviewermediafocus.h"
-#include "llviewermenu.h"
#include "llviewermessage.h"
#include "llviewerobjectlist.h"
#include "llviewerparcelmgr.h"
@@ -210,7 +203,6 @@
#include "llwindowlistener.h"
#include "llviewerwindowlistener.h"
-#include "llpaneltopinfobar.h"
#include "llcleanup.h"
#if LL_WINDOWS
@@ -497,7 +489,8 @@ public:
clearText();
- if (gSavedSettings.getBOOL("DebugShowTime"))
+ static LLCachedControl<bool> debug_show_time(gSavedSettings, "DebugShowTime", false);
+ if (debug_show_time())
{
F32 time = gFrameTimeSeconds;
S32 hours = (S32)(time / (60*60));
@@ -506,7 +499,8 @@ public:
addText(xpos, ypos, llformat("Time: %d:%02d:%02d", hours,mins,secs)); ypos += y_inc;
}
- if (gSavedSettings.getBOOL("DebugShowMemory"))
+ static LLCachedControl<bool> debug_show_memory(gSavedSettings, "DebugShowMemory", false);
+ if (debug_show_memory())
{
addText(xpos, ypos,
STRINGIZE("Memory: " << (LLMemory::getCurrentRSS() / 1024) << " (KB)"));
@@ -599,7 +593,8 @@ public:
ypos += y_inc;
}*/
- if (gSavedSettings.getBOOL("DebugShowRenderInfo"))
+ static LLCachedControl<bool> debug_show_render_info(gSavedSettings, "DebugShowRenderInfo", false);
+ if (debug_show_render_info())
{
LLTrace::Recording& last_frame_recording = LLTrace::get_frame_recording().getLastRecording();
@@ -738,7 +733,8 @@ public:
gPipeline.mNumVisibleNodes = LLPipeline::sVisibleLightCount = 0;
}
- if (gSavedSettings.getBOOL("DebugShowAvatarRenderInfo"))
+ static LLCachedControl<bool> debug_show_avatar_render_info(gSavedSettings, "DebugShowAvatarRenderInfo", false);
+ if (debug_show_avatar_render_info())
{
std::map<std::string, LLVOAvatar*> sorted_avs;
{
@@ -771,7 +767,8 @@ public:
av_iter++;
}
}
- if (gSavedSettings.getBOOL("DebugShowRenderMatrices"))
+ static LLCachedControl<bool> debug_show_render_matrices(gSavedSettings, "DebugShowRenderMatrices", false);
+ if (debug_show_render_matrices())
{
char camera_lines[8][32];
memset(camera_lines, ' ', sizeof(camera_lines));
@@ -797,7 +794,8 @@ public:
ypos += y_inc;
}
// disable use of glReadPixels which messes up nVidia nSight graphics debugging
- if (gSavedSettings.getBOOL("DebugShowColor") && !LLRender::sNsightDebugSupport)
+ static LLCachedControl<bool> debug_show_color(gSavedSettings, "DebugShowColor", false);
+ if (debug_show_color() && !LLRender::sNsightDebugSupport)
{
U8 color[4];
LLCoordGL coord = gViewerWindow->getCurrentMouse();
@@ -889,7 +887,8 @@ public:
}
}
- if (gSavedSettings.getBOOL("DebugShowTextureInfo"))
+ static LLCachedControl<bool> debug_show_texture_info(gSavedSettings, "DebugShowTextureInfo", false);
+ if (debug_show_texture_info())
{
LLViewerObject* objectp = NULL ;
@@ -1331,7 +1330,7 @@ LLWindowCallbacks::DragNDropResult LLViewerWindow::handleDragNDrop( LLWindow *wi
// Check the whitelist, if there's media (otherwise just show it)
if (te->getMediaData() == NULL || te->getMediaData()->checkCandidateUrl(url))
{
- if ( obj != mDragHoveredObject)
+ if ( obj != mDragHoveredObject.get())
{
// Highlight the dragged object
LLSelectMgr::getInstance()->unhighlightObjectOnly(mDragHoveredObject);
@@ -1458,10 +1457,13 @@ void LLViewerWindow::handleMouseLeave(LLWindow *window)
bool LLViewerWindow::handleCloseRequest(LLWindow *window)
{
- // User has indicated they want to close, but we may need to ask
- // about modified documents.
- LLAppViewer::instance()->userQuit();
- // Don't quit immediately
+ if (!LLApp::isExiting() && !LLApp::isStopped())
+ {
+ // User has indicated they want to close, but we may need to ask
+ // about modified documents.
+ LLAppViewer::instance()->userQuit();
+ // Don't quit immediately
+ }
return false;
}
@@ -1605,7 +1607,8 @@ bool LLViewerWindow::handleActivate(LLWindow *window, bool activated)
mActive = false;
// if the user has chosen to go Away automatically after some time, then go Away when minimizing
- if (gSavedSettings.getS32("AFKTimeout"))
+ static LLCachedControl<S32> afk_time(gSavedSettings, "AFKTimeout", 300);
+ if (afk_time())
{
gAgent.setAFK();
}
@@ -1746,6 +1749,7 @@ bool LLViewerWindow::handleDeviceChange(LLWindow *window)
bool LLViewerWindow::handleDPIChanged(LLWindow *window, F32 ui_scale_factor, S32 window_width, S32 window_height)
{
+ LLFontGL::sResolutionGeneration++;
if (ui_scale_factor >= MIN_UI_SCALE && ui_scale_factor <= MAX_UI_SCALE)
{
LLViewerWindow::reshape(window_width, window_height);
@@ -1759,6 +1763,12 @@ bool LLViewerWindow::handleDPIChanged(LLWindow *window, F32 ui_scale_factor, S32
}
}
+bool LLViewerWindow::handleDisplayChanged()
+{
+ LLFontGL::sResolutionGeneration++;
+ return false;
+}
+
bool LLViewerWindow::handleWindowDidChangeScreen(LLWindow *window)
{
LLCoordScreen window_rect;
@@ -1927,6 +1937,7 @@ LLViewerWindow::LLViewerWindow(const Params& p)
mDisplayScale.setVec(llmax(1.f / mWindow->getPixelAspectRatio(), 1.f), llmax(mWindow->getPixelAspectRatio(), 1.f));
mDisplayScale *= ui_scale_factor;
LLUI::setScaleFactor(mDisplayScale);
+ LLFontGL::sResolutionGeneration++;
{
LLCoordWindow size;
@@ -2282,13 +2293,13 @@ void LLViewerWindow::initWorldUI()
url = LLWeb::expandURLSubstitutions(url, LLSD());
destinations->navigateTo(url, HTTP_CONTENT_TEXT_HTML);
}
- LLMediaCtrl* avatar_picker = LLFloaterReg::getInstance("avatar")->findChild<LLMediaCtrl>("avatar_picker_contents");
- if (avatar_picker)
+ LLMediaCtrl* avatar_welcome_pack = LLFloaterReg::getInstance("avatar_welcome_pack")->findChild<LLMediaCtrl>("avatar_picker_contents");
+ if (avatar_welcome_pack)
{
- avatar_picker->setErrorPageURL(gSavedSettings.getString("GenericErrorPageURL"));
- std::string url = gSavedSettings.getString("AvatarPickerURL");
+ avatar_welcome_pack->setErrorPageURL(gSavedSettings.getString("GenericErrorPageURL"));
+ std::string url = gSavedSettings.getString("AvatarWelcomePack");
url = LLWeb::expandURLSubstitutions(url, LLSD());
- avatar_picker->navigateTo(url, HTTP_CONTENT_TEXT_HTML);
+ avatar_welcome_pack->navigateTo(url, HTTP_CONTENT_TEXT_HTML);
}
}
}
@@ -2496,6 +2507,7 @@ void LLViewerWindow::reshape(S32 width, S32 height)
bool display_scale_changed = mDisplayScale != LLUI::getScaleFactor();
LLUI::setScaleFactor(mDisplayScale);
+ LLFontGL::sResolutionGeneration++;
// update our window rectangle
mWindowRectScaled.mRight = mWindowRectScaled.mLeft + ll_round((F32)width / mDisplayScale.mV[VX]);
@@ -3836,7 +3848,7 @@ void LLViewerWindow::updateLayout()
void LLViewerWindow::updateMouseDelta()
{
-#if LL_WINDOWS
+#if LL_WINDOWS && !LL_SDL
LLCoordCommon delta;
mWindow->getCursorDelta(&delta);
S32 dx = delta.mX;
@@ -4799,26 +4811,23 @@ void LLViewerWindow::saveImageLocal(LLImageFormatted *image, const snapshot_save
}
// Look for an unused file name
- bool is_snapshot_name_loc_set = isSnapshotLocSet();
+ auto is_snapshot_name_loc_set = isSnapshotLocSet();
std::string filepath;
- S32 i = 1;
- S32 err = 0;
- std::string extension("." + image->getExtension());
+ auto i = 1;
+ auto err = 0;
+ auto extension("." + image->getExtension());
+ auto now = LLDate::now();
do
{
filepath = sSnapshotDir;
filepath += gDirUtilp->getDirDelimiter();
filepath += sSnapshotBaseName;
-
- if (is_snapshot_name_loc_set)
- {
- filepath += llformat("_%.3d",i);
- }
-
+ filepath += now.toLocalDateString("_%Y-%m-%d_%H%M%S");
+ filepath += llformat("%.2d", i);
filepath += extension;
llstat stat_info;
- err = LLFile::stat( filepath, &stat_info );
+ err = LLFile::stat(filepath, &stat_info);
i++;
}
while( -1 != err // Search until the file is not found (i.e., stat() gives an error).
@@ -4853,12 +4862,12 @@ void LLViewerWindow::movieSize(S32 new_width, S32 new_height)
}
}
-bool LLViewerWindow::saveSnapshot(const std::string& filepath, S32 image_width, S32 image_height, bool show_ui, bool show_hud, bool do_rebuild, LLSnapshotModel::ESnapshotLayerType type, LLSnapshotModel::ESnapshotFormat format)
+bool LLViewerWindow::saveSnapshot(const std::string& filepath, S32 image_width, S32 image_height, bool show_ui, bool show_hud, bool do_rebuild, bool show_balance, LLSnapshotModel::ESnapshotLayerType type, LLSnapshotModel::ESnapshotFormat format)
{
LL_INFOS() << "Saving snapshot to: " << filepath << LL_ENDL;
LLPointer<LLImageRaw> raw = new LLImageRaw;
- bool success = rawSnapshot(raw, image_width, image_height, true, false, show_ui, show_hud, do_rebuild);
+ bool success = rawSnapshot(raw, image_width, image_height, true, false, show_ui, show_hud, do_rebuild, show_balance);
if (success)
{
@@ -4919,14 +4928,14 @@ void LLViewerWindow::resetSnapshotLoc() const
bool LLViewerWindow::thumbnailSnapshot(LLImageRaw *raw, S32 preview_width, S32 preview_height, bool show_ui, bool show_hud, bool do_rebuild, bool no_post, LLSnapshotModel::ESnapshotLayerType type)
{
- return rawSnapshot(raw, preview_width, preview_height, false, false, show_ui, show_hud, do_rebuild, no_post, type);
+ return rawSnapshot(raw, preview_width, preview_height, false, false, show_ui, show_hud, do_rebuild, no_post, gSavedSettings.getBOOL("RenderBalanceInSnapshot"), type);
}
// Saves the image from the screen to a raw image
// Since the required size might be bigger than the available screen, this method rerenders the scene in parts (called subimages) and copy
// the results over to the final raw image.
bool LLViewerWindow::rawSnapshot(LLImageRaw *raw, S32 image_width, S32 image_height,
- bool keep_window_aspect, bool is_texture, bool show_ui, bool show_hud, bool do_rebuild, bool no_post, LLSnapshotModel::ESnapshotLayerType type, S32 max_size)
+ bool keep_window_aspect, bool is_texture, bool show_ui, bool show_hud, bool do_rebuild, bool no_post, bool show_balance, LLSnapshotModel::ESnapshotLayerType type, S32 max_size)
{
if (!raw)
{
@@ -4984,6 +4993,8 @@ bool LLViewerWindow::rawSnapshot(LLImageRaw *raw, S32 image_width, S32 image_hei
// If the user wants the UI, limit the output size to the available screen size
image_width = llmin(image_width, window_width);
image_height = llmin(image_height, window_height);
+
+ setBalanceVisible(show_balance);
}
S32 original_width = 0;
@@ -5061,11 +5072,13 @@ bool LLViewerWindow::rawSnapshot(LLImageRaw *raw, S32 image_width, S32 image_hei
}
else
{
+ setBalanceVisible(true);
return false;
}
if (raw->isBufferInvalid())
{
+ setBalanceVisible(true);
return false;
}
@@ -5241,6 +5254,7 @@ bool LLViewerWindow::rawSnapshot(LLImageRaw *raw, S32 image_width, S32 image_hei
{
send_agent_resume();
}
+ setBalanceVisible(true);
return ret;
}
@@ -5706,6 +5720,14 @@ void LLViewerWindow::setProgressCancelButtonVisible( bool b, const std::string&
}
}
+void LLViewerWindow::setBalanceVisible(bool visible)
+{
+ if (gStatusBar)
+ {
+ gStatusBar->setBalanceVisible(visible);
+ }
+}
+
LLProgressView *LLViewerWindow::getProgressView() const
{
return mProgressView;
@@ -6171,7 +6193,7 @@ void LLPickInfo::fetchResults()
mObjectOffset = gAgentCamera.calcFocusOffset(objectp, v_intersection, mPickPt.mX, mPickPt.mY);
mObjectID = objectp->mID;
mObjectFace = (te_offset == NO_FACE) ? -1 : (S32)te_offset;
-
+ mPickHUD = objectp->isHUDAttachment();
mPosGlobal = gAgent.getPosGlobalFromAgent(v_intersection);