aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/newview/llfloatersnapshot.cpp
diff options
context:
space:
mode:
authorJacek Antonelli2008-08-15 23:45:50 -0500
committerJacek Antonelli2008-08-15 23:45:50 -0500
commit2a4dea528f670b9bb1f77ef27a8a1dd16603d114 (patch)
tree95c68e362703c9099d571ecbdc6142b1cda1e005 /linden/indra/newview/llfloatersnapshot.cpp
parentSecond Life viewer sources 1.20.6 (diff)
downloadmeta-impy-2a4dea528f670b9bb1f77ef27a8a1dd16603d114.zip
meta-impy-2a4dea528f670b9bb1f77ef27a8a1dd16603d114.tar.gz
meta-impy-2a4dea528f670b9bb1f77ef27a8a1dd16603d114.tar.bz2
meta-impy-2a4dea528f670b9bb1f77ef27a8a1dd16603d114.tar.xz
Second Life viewer sources 1.20.7
Diffstat (limited to 'linden/indra/newview/llfloatersnapshot.cpp')
-rw-r--r--linden/indra/newview/llfloatersnapshot.cpp68
1 files changed, 55 insertions, 13 deletions
diff --git a/linden/indra/newview/llfloatersnapshot.cpp b/linden/indra/newview/llfloatersnapshot.cpp
index c36c54d..f3ad4a7 100644
--- a/linden/indra/newview/llfloatersnapshot.cpp
+++ b/linden/indra/newview/llfloatersnapshot.cpp
@@ -36,7 +36,7 @@
36#include "llfontgl.h" 36#include "llfontgl.h"
37#include "llsys.h" 37#include "llsys.h"
38#include "llgl.h" 38#include "llgl.h"
39#include "llglimmediate.h" 39#include "llrender.h"
40#include "v3dmath.h" 40#include "v3dmath.h"
41#include "llmath.h" 41#include "llmath.h"
42#include "lldir.h" 42#include "lldir.h"
@@ -183,6 +183,7 @@ protected:
183 LLQuaternion mCameraRot; 183 LLQuaternion mCameraRot;
184 BOOL mSnapshotActive; 184 BOOL mSnapshotActive;
185 LLViewerWindow::ESnapshotType mSnapshotBufferType; 185 LLViewerWindow::ESnapshotType mSnapshotBufferType;
186 bool mSnapshotSoundPlayed;
186 187
187public: 188public:
188 static std::set<LLSnapshotLivePreview*> sList; 189 static std::set<LLSnapshotLivePreview*> sList;
@@ -208,7 +209,8 @@ LLSnapshotLivePreview::LLSnapshotLivePreview (const LLRect& rect) :
208 mCameraPos(LLViewerCamera::getInstance()->getOrigin()), 209 mCameraPos(LLViewerCamera::getInstance()->getOrigin()),
209 mCameraRot(LLViewerCamera::getInstance()->getQuaternion()), 210 mCameraRot(LLViewerCamera::getInstance()->getQuaternion()),
210 mSnapshotActive(FALSE), 211 mSnapshotActive(FALSE),
211 mSnapshotBufferType(LLViewerWindow::SNAPSHOT_TYPE_COLOR) 212 mSnapshotBufferType(LLViewerWindow::SNAPSHOT_TYPE_COLOR),
213 mSnapshotSoundPlayed(false)
212{ 214{
213 mSnapshotDelayTimer.setTimerExpirySec(0.0f); 215 mSnapshotDelayTimer.setTimerExpirySec(0.0f);
214 mSnapshotDelayTimer.start(); 216 mSnapshotDelayTimer.start();
@@ -764,6 +766,19 @@ void LLSnapshotLivePreview::onIdle( void* snapshot_preview )
764 { 766 {
765 previewp->mRawImageEncoded->resize(previewp->mRawImage->getWidth(), previewp->mRawImage->getHeight(), previewp->mRawImage->getComponents()); 767 previewp->mRawImageEncoded->resize(previewp->mRawImage->getWidth(), previewp->mRawImage->getHeight(), previewp->mRawImage->getComponents());
766 768
769 if (!gSavedSettings.getBOOL("QuietSnapshotsToDisk"))
770 {
771 // Always play the sound once, on window open.
772 // Don't keep playing if automatic
773 // updates are enabled. It's too invasive. JC
774 if (!previewp->mSnapshotSoundPlayed
775 || !gSavedSettings.getBOOL("AutoSnapshot") )
776 {
777 gViewerWindow->playSnapshotAnimAndSound();
778 previewp->mSnapshotSoundPlayed = true;
779 }
780 }
781
767 if (previewp->getSnapshotType() == SNAPSHOT_POSTCARD) 782 if (previewp->getSnapshotType() == SNAPSHOT_POSTCARD)
768 { 783 {
769 // *FIX: just resize and reuse existing jpeg? 784 // *FIX: just resize and reuse existing jpeg?
@@ -923,7 +938,9 @@ BOOL LLSnapshotLivePreview::saveLocal()
923class LLFloaterSnapshot::Impl 938class LLFloaterSnapshot::Impl
924{ 939{
925public: 940public:
926 Impl() : mLastToolset(NULL) 941 Impl()
942 : mAvatarPauseHandles(),
943 mLastToolset(NULL)
927 { 944 {
928 } 945 }
929 ~Impl() 946 ~Impl()
@@ -1054,7 +1071,13 @@ void LLFloaterSnapshot::Impl::updateLayout(LLFloaterSnapshot* floaterp)
1054 previewp->setSize(gViewerWindow->getWindowDisplayWidth(), gViewerWindow->getWindowDisplayHeight()); 1071 previewp->setSize(gViewerWindow->getWindowDisplayWidth(), gViewerWindow->getWindowDisplayHeight());
1055 } 1072 }
1056 1073
1057 if (floaterp->childGetValue("freeze_frame_check").asBoolean()) 1074 bool use_freeze_frame = floaterp->childGetValue("freeze_frame_check").asBoolean();
1075 // For now, auto-snapshot only works in freeze frame mode.
1076 // This can be changed in the future by taking the FreezeTime check
1077 // out of the onIdle() camera movement detection. JC
1078 floaterp->childSetEnabled("auto_snapshot_check", use_freeze_frame);
1079
1080 if (use_freeze_frame)
1058 { 1081 {
1059 // stop all mouse events at fullscreen preview layer 1082 // stop all mouse events at fullscreen preview layer
1060 floaterp->getParent()->setMouseOpaque(TRUE); 1083 floaterp->getParent()->setMouseOpaque(TRUE);
@@ -1089,6 +1112,9 @@ void LLFloaterSnapshot::Impl::updateLayout(LLFloaterSnapshot* floaterp)
1089 } 1112 }
1090 else // turning off freeze frame mode 1113 else // turning off freeze frame mode
1091 { 1114 {
1115 // Force off auto-snapshot, see comment above about onIdle. JC
1116 gSavedSettings.setBOOL("AutoSnapshot", FALSE);
1117
1092 floaterp->getParent()->setMouseOpaque(FALSE); 1118 floaterp->getParent()->setMouseOpaque(FALSE);
1093 floaterp->reshape(floaterp->getRect().getWidth(), floaterp->getUIWinHeightLong() + delta_height); 1119 floaterp->reshape(floaterp->getRect().getWidth(), floaterp->getUIWinHeightLong() + delta_height);
1094 if (previewp) 1120 if (previewp)
@@ -1287,12 +1313,6 @@ void LLFloaterSnapshot::Impl::onClickKeep(void* data)
1287 if (gSavedSettings.getBOOL("CloseSnapshotOnKeep")) 1313 if (gSavedSettings.getBOOL("CloseSnapshotOnKeep"))
1288 { 1314 {
1289 view->close(); 1315 view->close();
1290 // only plays sound and anim when keeping a snapshot, and closing the snapshot UI,
1291 // and only if the save succeeded (i.e. was not canceled)
1292 if (succeeded)
1293 {
1294 gViewerWindow->playSnapshotAnimAndSound();
1295 }
1296 } 1316 }
1297 else 1317 else
1298 { 1318 {
@@ -1674,13 +1694,13 @@ void LLFloaterSnapshot::Impl::resetSnapshotSizeOnUI(LLFloaterSnapshot *view, S32
1674 LLSpinCtrl *sctrl = view->getChild<LLSpinCtrl>("snapshot_width") ; 1694 LLSpinCtrl *sctrl = view->getChild<LLSpinCtrl>("snapshot_width") ;
1675 if(sctrl) 1695 if(sctrl)
1676 { 1696 {
1677 sctrl->setValue(width) ; 1697 sctrl->forceSetValue(width) ;
1678 } 1698 }
1679 1699
1680 sctrl = view->getChild<LLSpinCtrl>("snapshot_height") ; 1700 sctrl = view->getChild<LLSpinCtrl>("snapshot_height") ;
1681 if(sctrl) 1701 if(sctrl)
1682 { 1702 {
1683 sctrl->setValue(height) ; 1703 sctrl->forceSetValue(height) ;
1684 } 1704 }
1685 1705
1686 gSavedSettings.setS32("LastSnapshotWidth", width); 1706 gSavedSettings.setS32("LastSnapshotWidth", width);
@@ -1707,8 +1727,30 @@ void LLFloaterSnapshot::Impl::onCommitCustomResolution(LLUICtrl *ctrl, void* dat
1707 1727
1708 if (w != curw || h != curh) 1728 if (w != curw || h != curh)
1709 { 1729 {
1730 BOOL update_ = FALSE ;
1731 //if to upload a snapshot, process spinner input in a special way.
1732 if(LLSnapshotLivePreview::SNAPSHOT_TEXTURE == gSavedSettings.getS32("LastSnapshotType"))
1733 {
1734 S32 spinner_increment = (S32)((LLSpinCtrl*)ctrl)->getIncrement() ;
1735 S32 dw = w - curw ;
1736 S32 dh = h - curh ;
1737 dw = (dw == spinner_increment) ? 1 : ((dw == -spinner_increment) ? -1 : 0) ;
1738 dh = (dh == spinner_increment) ? 1 : ((dh == -spinner_increment) ? -1 : 0) ;
1739
1740 if(dw)
1741 {
1742 w = (dw > 0) ? curw << dw : curw >> -dw ;
1743 update_ = TRUE ;
1744 }
1745 if(dh)
1746 {
1747 h = (dh > 0) ? curh << dh : curh >> -dh ;
1748 update_ = TRUE ;
1749 }
1750 }
1751
1710 previewp->setMaxImageSize((S32)((LLSpinCtrl *)ctrl)->getMaxValue()) ; 1752 previewp->setMaxImageSize((S32)((LLSpinCtrl *)ctrl)->getMaxValue()) ;
1711 if(checkImageSize(previewp, w, h, w != curw, previewp->getMaxImageSize())) 1753 if(checkImageSize(previewp, w, h, w != curw, previewp->getMaxImageSize()) || update_)
1712 { 1754 {
1713 resetSnapshotSizeOnUI(view, w, h) ; 1755 resetSnapshotSizeOnUI(view, w, h) ;
1714 } 1756 }