diff options
Diffstat (limited to 'linden/indra/newview/llfloatersnapshot.cpp')
-rw-r--r-- | linden/indra/newview/llfloatersnapshot.cpp | 285 |
1 files changed, 146 insertions, 139 deletions
diff --git a/linden/indra/newview/llfloatersnapshot.cpp b/linden/indra/newview/llfloatersnapshot.cpp index 954bf9f..afa0785 100644 --- a/linden/indra/newview/llfloatersnapshot.cpp +++ b/linden/indra/newview/llfloatersnapshot.cpp | |||
@@ -151,7 +151,8 @@ public: | |||
151 | void resetThumbnailImage() { mThumbnailImage = NULL ; } | 151 | void resetThumbnailImage() { mThumbnailImage = NULL ; } |
152 | void drawPreviewRect(S32 offset_x, S32 offset_y) ; | 152 | void drawPreviewRect(S32 offset_x, S32 offset_y) ; |
153 | 153 | ||
154 | static void onIdle( void* snapshot_preview ); | 154 | // Returns TRUE when snapshot generated, FALSE otherwise. |
155 | static BOOL onIdle( void* snapshot_preview ); | ||
155 | 156 | ||
156 | private: | 157 | private: |
157 | LLColor4 mColor; | 158 | LLColor4 mColor; |
@@ -203,6 +204,8 @@ LLSnapshotLivePreview::LLSnapshotLivePreview (const LLRect& rect) : | |||
203 | mCurImageIndex(0), | 204 | mCurImageIndex(0), |
204 | mPreviewImage(NULL), | 205 | mPreviewImage(NULL), |
205 | mThumbnailImage(NULL) , | 206 | mThumbnailImage(NULL) , |
207 | mThumbnailWidth(0), | ||
208 | mThumbnailHeight(0), | ||
206 | mPreviewImageEncoded(NULL), | 209 | mPreviewImageEncoded(NULL), |
207 | mFormattedImage(NULL), | 210 | mFormattedImage(NULL), |
208 | mShineCountdown(0), | 211 | mShineCountdown(0), |
@@ -342,14 +345,11 @@ void LLSnapshotLivePreview::updateSnapshot(BOOL new_snapshot, BOOL new_thumbnail | |||
342 | mSnapshotDelayTimer.start(); | 345 | mSnapshotDelayTimer.start(); |
343 | mSnapshotDelayTimer.setTimerExpirySec(delay); | 346 | mSnapshotDelayTimer.setTimerExpirySec(delay); |
344 | } | 347 | } |
345 | else if(new_thumbnail) | 348 | if(new_thumbnail) |
346 | { | 349 | { |
347 | mThumbnailUpToDate = FALSE ; | 350 | mThumbnailUpToDate = FALSE ; |
348 | } | 351 | } |
349 | else | 352 | setThumbnailImageSize(); |
350 | { | ||
351 | setThumbnailImageSize() ; | ||
352 | } | ||
353 | } | 353 | } |
354 | 354 | ||
355 | void LLSnapshotLivePreview::setSnapshotQuality(S32 quality) | 355 | void LLSnapshotLivePreview::setSnapshotQuality(S32 quality) |
@@ -417,14 +417,14 @@ void LLSnapshotLivePreview::draw() | |||
417 | 417 | ||
418 | LLColor4 image_color(1.f, 1.f, 1.f, 1.f); | 418 | LLColor4 image_color(1.f, 1.f, 1.f, 1.f); |
419 | gGL.color4fv(image_color.mV); | 419 | gGL.color4fv(image_color.mV); |
420 | LLViewerImage::bindTexture(mViewerImage[mCurImageIndex]); | 420 | gGL.getTexUnit(0)->bind(mViewerImage[mCurImageIndex]); |
421 | // calculate UV scale | 421 | // calculate UV scale |
422 | F32 uv_width = mImageScaled[mCurImageIndex] ? 1.f : llmin((F32)mWidth[mCurImageIndex] / (F32)mViewerImage[mCurImageIndex]->getWidth(), 1.f); | 422 | F32 uv_width = mImageScaled[mCurImageIndex] ? 1.f : llmin((F32)mWidth[mCurImageIndex] / (F32)mViewerImage[mCurImageIndex]->getWidth(), 1.f); |
423 | F32 uv_height = mImageScaled[mCurImageIndex] ? 1.f : llmin((F32)mHeight[mCurImageIndex] / (F32)mViewerImage[mCurImageIndex]->getHeight(), 1.f); | 423 | F32 uv_height = mImageScaled[mCurImageIndex] ? 1.f : llmin((F32)mHeight[mCurImageIndex] / (F32)mViewerImage[mCurImageIndex]->getHeight(), 1.f); |
424 | glPushMatrix(); | 424 | glPushMatrix(); |
425 | { | 425 | { |
426 | glTranslatef((F32)rect.mLeft, (F32)rect.mBottom, 0.f); | 426 | glTranslatef((F32)rect.mLeft, (F32)rect.mBottom, 0.f); |
427 | gGL.begin(LLVertexBuffer::QUADS); | 427 | gGL.begin(LLRender::QUADS); |
428 | { | 428 | { |
429 | gGL.texCoord2f(uv_width, uv_height); | 429 | gGL.texCoord2f(uv_width, uv_height); |
430 | gGL.vertex2i(rect.getWidth(), rect.getHeight() ); | 430 | gGL.vertex2i(rect.getWidth(), rect.getHeight() ); |
@@ -486,8 +486,8 @@ void LLSnapshotLivePreview::draw() | |||
486 | S32 y1 = 0; | 486 | S32 y1 = 0; |
487 | S32 y2 = gViewerWindow->getWindowHeight(); | 487 | S32 y2 = gViewerWindow->getWindowHeight(); |
488 | 488 | ||
489 | LLGLSNoTexture no_texture; | 489 | gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); |
490 | gGL.begin(LLVertexBuffer::QUADS); | 490 | gGL.begin(LLRender::QUADS); |
491 | { | 491 | { |
492 | gGL.color4f(1.f, 1.f, 1.f, 0.f); | 492 | gGL.color4f(1.f, 1.f, 1.f, 0.f); |
493 | gGL.vertex2i(x1, y1); | 493 | gGL.vertex2i(x1, y1); |
@@ -515,10 +515,10 @@ void LLSnapshotLivePreview::draw() | |||
515 | 515 | ||
516 | // draw framing rectangle | 516 | // draw framing rectangle |
517 | { | 517 | { |
518 | LLGLSNoTexture no_texture; | 518 | gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); |
519 | gGL.color4f(1.f, 1.f, 1.f, 1.f); | 519 | gGL.color4f(1.f, 1.f, 1.f, 1.f); |
520 | LLRect outline_rect = mImageRect[mCurImageIndex]; | 520 | LLRect outline_rect = mImageRect[mCurImageIndex]; |
521 | gGL.begin(LLVertexBuffer::QUADS); | 521 | gGL.begin(LLRender::QUADS); |
522 | { | 522 | { |
523 | gGL.vertex2i(outline_rect.mLeft - BORDER_WIDTH, outline_rect.mTop + BORDER_WIDTH); | 523 | gGL.vertex2i(outline_rect.mLeft - BORDER_WIDTH, outline_rect.mTop + BORDER_WIDTH); |
524 | gGL.vertex2i(outline_rect.mRight + BORDER_WIDTH, outline_rect.mTop + BORDER_WIDTH); | 524 | gGL.vertex2i(outline_rect.mRight + BORDER_WIDTH, outline_rect.mTop + BORDER_WIDTH); |
@@ -553,7 +553,7 @@ void LLSnapshotLivePreview::draw() | |||
553 | F32 alpha = clamp_rescale(fall_interp, 0.f, 1.f, 0.8f, 0.4f); | 553 | F32 alpha = clamp_rescale(fall_interp, 0.f, 1.f, 0.8f, 0.4f); |
554 | LLColor4 image_color(1.f, 1.f, 1.f, alpha); | 554 | LLColor4 image_color(1.f, 1.f, 1.f, alpha); |
555 | gGL.color4fv(image_color.mV); | 555 | gGL.color4fv(image_color.mV); |
556 | LLViewerImage::bindTexture(mViewerImage[old_image_index]); | 556 | gGL.getTexUnit(0)->bind(mViewerImage[old_image_index]); |
557 | // calculate UV scale | 557 | // calculate UV scale |
558 | // *FIX get this to work with old image | 558 | // *FIX get this to work with old image |
559 | BOOL rescale = !mImageScaled[old_image_index] && mViewerImage[mCurImageIndex].notNull(); | 559 | BOOL rescale = !mImageScaled[old_image_index] && mViewerImage[mCurImageIndex].notNull(); |
@@ -564,7 +564,7 @@ void LLSnapshotLivePreview::draw() | |||
564 | LLRect& rect = mImageRect[old_image_index]; | 564 | LLRect& rect = mImageRect[old_image_index]; |
565 | glTranslatef((F32)rect.mLeft, (F32)rect.mBottom - llround(getRect().getHeight() * 2.f * (fall_interp * fall_interp)), 0.f); | 565 | glTranslatef((F32)rect.mLeft, (F32)rect.mBottom - llround(getRect().getHeight() * 2.f * (fall_interp * fall_interp)), 0.f); |
566 | glRotatef(-45.f * fall_interp, 0.f, 0.f, 1.f); | 566 | glRotatef(-45.f * fall_interp, 0.f, 0.f, 1.f); |
567 | gGL.begin(LLVertexBuffer::QUADS); | 567 | gGL.begin(LLRender::QUADS); |
568 | { | 568 | { |
569 | gGL.texCoord2f(uv_width, uv_height); | 569 | gGL.texCoord2f(uv_width, uv_height); |
570 | gGL.vertex2i(rect.getWidth(), rect.getHeight() ); | 570 | gGL.vertex2i(rect.getWidth(), rect.getHeight() ); |
@@ -719,8 +719,11 @@ void LLSnapshotLivePreview::generateThumbnailImage(BOOL force_update) | |||
719 | mThumbnailUpdateLock = FALSE ; | 719 | mThumbnailUpdateLock = FALSE ; |
720 | } | 720 | } |
721 | 721 | ||
722 | |||
723 | // Called often. Checks whether it's time to grab a new snapshot and if so, does it. | ||
724 | // Returns TRUE if new snapshot generated, FALSE otherwise. | ||
722 | //static | 725 | //static |
723 | void LLSnapshotLivePreview::onIdle( void* snapshot_preview ) | 726 | BOOL LLSnapshotLivePreview::onIdle( void* snapshot_preview ) |
724 | { | 727 | { |
725 | LLSnapshotLivePreview* previewp = (LLSnapshotLivePreview*)snapshot_preview; | 728 | LLSnapshotLivePreview* previewp = (LLSnapshotLivePreview*)snapshot_preview; |
726 | 729 | ||
@@ -733,7 +736,10 @@ void LLSnapshotLivePreview::onIdle( void* snapshot_preview ) | |||
733 | previewp->mCameraRot = new_camera_rot; | 736 | previewp->mCameraRot = new_camera_rot; |
734 | // request a new snapshot whenever the camera moves, with a time delay | 737 | // request a new snapshot whenever the camera moves, with a time delay |
735 | BOOL autosnap = gSavedSettings.getBOOL("AutoSnapshot"); | 738 | BOOL autosnap = gSavedSettings.getBOOL("AutoSnapshot"); |
736 | previewp->updateSnapshot(autosnap, FALSE, autosnap ? AUTO_SNAPSHOT_TIME_DELAY : 0.f); | 739 | previewp->updateSnapshot( |
740 | autosnap, // whether a new snapshot is needed or merely invalidate the existing one | ||
741 | FALSE, // or if 1st arg is false, whether to produce a new thumbnail image. | ||
742 | autosnap ? AUTO_SNAPSHOT_TIME_DELAY : 0.f); // shutter delay if 1st arg is true. | ||
737 | } | 743 | } |
738 | 744 | ||
739 | // see if it's time yet to snap the shot and bomb out otherwise. | 745 | // see if it's time yet to snap the shot and bomb out otherwise. |
@@ -742,7 +748,7 @@ void LLSnapshotLivePreview::onIdle( void* snapshot_preview ) | |||
742 | && !LLToolCamera::getInstance()->hasMouseCapture(); // don't take snapshots while ALT-zoom active | 748 | && !LLToolCamera::getInstance()->hasMouseCapture(); // don't take snapshots while ALT-zoom active |
743 | if ( ! previewp->mSnapshotActive) | 749 | if ( ! previewp->mSnapshotActive) |
744 | { | 750 | { |
745 | return; | 751 | return FALSE; |
746 | } | 752 | } |
747 | 753 | ||
748 | // time to produce a snapshot | 754 | // time to produce a snapshot |
@@ -819,6 +825,7 @@ void LLSnapshotLivePreview::onIdle( void* snapshot_preview ) | |||
819 | } | 825 | } |
820 | if (previewp->mFormattedImage->encode(previewp->mPreviewImage, 0)) | 826 | if (previewp->mFormattedImage->encode(previewp->mPreviewImage, 0)) |
821 | { | 827 | { |
828 | previewp->mDataSize = previewp->mFormattedImage->getDataSize(); | ||
822 | // special case BMP to copy instead of decode otherwise decode will crash. | 829 | // special case BMP to copy instead of decode otherwise decode will crash. |
823 | if(format == LLFloaterSnapshot::SNAPSHOT_FORMAT_BMP) | 830 | if(format == LLFloaterSnapshot::SNAPSHOT_FORMAT_BMP) |
824 | { | 831 | { |
@@ -826,7 +833,6 @@ void LLSnapshotLivePreview::onIdle( void* snapshot_preview ) | |||
826 | } | 833 | } |
827 | else | 834 | else |
828 | { | 835 | { |
829 | previewp->mDataSize = previewp->mFormattedImage->getDataSize(); | ||
830 | previewp->mFormattedImage->decode(previewp->mPreviewImageEncoded, 0); | 836 | previewp->mFormattedImage->decode(previewp->mPreviewImageEncoded, 0); |
831 | } | 837 | } |
832 | } | 838 | } |
@@ -855,7 +861,7 @@ void LLSnapshotLivePreview::onIdle( void* snapshot_preview ) | |||
855 | 861 | ||
856 | previewp->mViewerImage[previewp->mCurImageIndex] = new LLImageGL(scaled, FALSE); | 862 | previewp->mViewerImage[previewp->mCurImageIndex] = new LLImageGL(scaled, FALSE); |
857 | previewp->mViewerImage[previewp->mCurImageIndex]->setMipFilterNearest(previewp->getSnapshotType() != SNAPSHOT_TEXTURE); | 863 | previewp->mViewerImage[previewp->mCurImageIndex]->setMipFilterNearest(previewp->getSnapshotType() != SNAPSHOT_TEXTURE); |
858 | LLViewerImage::bindTexture(previewp->mViewerImage[previewp->mCurImageIndex]); | 864 | gGL.getTexUnit(0)->bind(previewp->mViewerImage[previewp->mCurImageIndex]); |
859 | previewp->mViewerImage[previewp->mCurImageIndex]->setClamp(TRUE, TRUE); | 865 | previewp->mViewerImage[previewp->mCurImageIndex]->setClamp(TRUE, TRUE); |
860 | 866 | ||
861 | previewp->mSnapshotUpToDate = TRUE; | 867 | previewp->mSnapshotUpToDate = TRUE; |
@@ -875,6 +881,8 @@ void LLSnapshotLivePreview::onIdle( void* snapshot_preview ) | |||
875 | { | 881 | { |
876 | previewp->generateThumbnailImage() ; | 882 | previewp->generateThumbnailImage() ; |
877 | } | 883 | } |
884 | |||
885 | return TRUE; | ||
878 | } | 886 | } |
879 | 887 | ||
880 | void LLSnapshotLivePreview::setSize(S32 w, S32 h) | 888 | void LLSnapshotLivePreview::setSize(S32 w, S32 h) |
@@ -952,7 +960,7 @@ void LLSnapshotLivePreview::saveTexture() | |||
952 | llwarns << "Error encoding snapshot" << llendl; | 960 | llwarns << "Error encoding snapshot" << llendl; |
953 | } | 961 | } |
954 | 962 | ||
955 | LLViewerStats::getInstance()->incStat(LLViewerStats::ST_SNAPSHOT_COUNT ); | 963 | LLViewerStats::getInstance()->incStat(LLViewerStats::ST_SNAPSHOT_COUNT ); |
956 | } | 964 | } |
957 | 965 | ||
958 | BOOL LLSnapshotLivePreview::saveLocal() | 966 | BOOL LLSnapshotLivePreview::saveLocal() |
@@ -996,7 +1004,8 @@ public: | |||
996 | static void onClickKeepOpenCheck(LLUICtrl *ctrl, void* data); | 1004 | static void onClickKeepOpenCheck(LLUICtrl *ctrl, void* data); |
997 | static void onClickKeepAspectCheck(LLUICtrl *ctrl, void* data); | 1005 | static void onClickKeepAspectCheck(LLUICtrl *ctrl, void* data); |
998 | static void onCommitQuality(LLUICtrl* ctrl, void* data); | 1006 | static void onCommitQuality(LLUICtrl* ctrl, void* data); |
999 | static void onCommitResolution(LLUICtrl* ctrl, void* data); | 1007 | static void onCommitResolution(LLUICtrl* ctrl, void* data) { updateResolution(ctrl, data); } |
1008 | static void updateResolution(LLUICtrl* ctrl, void* data, BOOL do_update = TRUE); | ||
1000 | static void onCommitFreezeFrame(LLUICtrl* ctrl, void* data); | 1009 | static void onCommitFreezeFrame(LLUICtrl* ctrl, void* data); |
1001 | static void onCommitLayerTypes(LLUICtrl* ctrl, void*data); | 1010 | static void onCommitLayerTypes(LLUICtrl* ctrl, void*data); |
1002 | static void onCommitSnapshotType(LLUICtrl* ctrl, void* data); | 1011 | static void onCommitSnapshotType(LLUICtrl* ctrl, void* data); |
@@ -1093,11 +1102,8 @@ LLViewerWindow::ESnapshotType LLFloaterSnapshot::Impl::getLayerType(LLFloaterSna | |||
1093 | void LLFloaterSnapshot::Impl::setResolution(LLFloaterSnapshot* floater, const std::string& comboname) | 1102 | void LLFloaterSnapshot::Impl::setResolution(LLFloaterSnapshot* floater, const std::string& comboname) |
1094 | { | 1103 | { |
1095 | LLComboBox* combo = floater->getChild<LLComboBox>(comboname); | 1104 | LLComboBox* combo = floater->getChild<LLComboBox>(comboname); |
1096 | if (combo) | ||
1097 | { | ||
1098 | combo->setVisible(TRUE); | 1105 | combo->setVisible(TRUE); |
1099 | onCommitResolution(combo, floater); | 1106 | updateResolution(combo, floater, FALSE); // to sync spinners with combo |
1100 | } | ||
1101 | } | 1107 | } |
1102 | 1108 | ||
1103 | //static | 1109 | //static |
@@ -1107,22 +1113,18 @@ void LLFloaterSnapshot::Impl::updateLayout(LLFloaterSnapshot* floaterp) | |||
1107 | 1113 | ||
1108 | S32 delta_height = gSavedSettings.getBOOL("AdvanceSnapshot") ? 0 : floaterp->getUIWinHeightShort() - floaterp->getUIWinHeightLong() ; | 1114 | S32 delta_height = gSavedSettings.getBOOL("AdvanceSnapshot") ? 0 : floaterp->getUIWinHeightShort() - floaterp->getUIWinHeightLong() ; |
1109 | 1115 | ||
1110 | LLComboBox* combo; | ||
1111 | if(!gSavedSettings.getBOOL("AdvanceSnapshot")) //set to original window resolution | 1116 | if(!gSavedSettings.getBOOL("AdvanceSnapshot")) //set to original window resolution |
1112 | { | 1117 | { |
1113 | previewp->mKeepAspectRatio = TRUE ; | 1118 | previewp->mKeepAspectRatio = TRUE; |
1114 | 1119 | ||
1115 | combo = floaterp->getChild<LLComboBox>("postcard_size_combo"); | 1120 | floaterp->getChild<LLComboBox>("postcard_size_combo")->setCurrentByIndex(0); |
1116 | combo->setCurrentByIndex(0) ; | 1121 | gSavedSettings.setS32("SnapshotPostcardLastResolution", 0); |
1117 | gSavedSettings.setS32("SnapshotPostcardLastResolution", 0) ; | ||
1118 | 1122 | ||
1119 | combo = floaterp->getChild<LLComboBox>("texture_size_combo"); | 1123 | floaterp->getChild<LLComboBox>("texture_size_combo")->setCurrentByIndex(0); |
1120 | combo->setCurrentByIndex(0) ; | 1124 | gSavedSettings.setS32("SnapshotTextureLastResolution", 0); |
1121 | gSavedSettings.setS32("SnapshotTextureLastResolution", 0) ; | ||
1122 | 1125 | ||
1123 | combo = floaterp->getChild<LLComboBox>("local_size_combo"); | 1126 | floaterp->getChild<LLComboBox>("local_size_combo")->setCurrentByIndex(0); |
1124 | combo->setCurrentByIndex(0) ; | 1127 | gSavedSettings.setS32("SnapshotLocalLastResolution", 0); |
1125 | gSavedSettings.setS32("SnapshotLocalLastResolution", 0) ; | ||
1126 | 1128 | ||
1127 | LLSnapshotLivePreview* previewp = getPreviewView(floaterp); | 1129 | LLSnapshotLivePreview* previewp = getPreviewView(floaterp); |
1128 | previewp->setSize(gViewerWindow->getWindowDisplayWidth(), gViewerWindow->getWindowDisplayHeight()); | 1130 | previewp->setSize(gViewerWindow->getWindowDisplayWidth(), gViewerWindow->getWindowDisplayHeight()); |
@@ -1187,7 +1189,11 @@ void LLFloaterSnapshot::Impl::updateLayout(LLFloaterSnapshot* floaterp) | |||
1187 | } | 1189 | } |
1188 | } | 1190 | } |
1189 | 1191 | ||
1190 | 1192 | // This is the main function that keeps all the GUI controls in sync with the saved settings. | |
1193 | // It should be called anytime a setting is changed that could affect the controls. | ||
1194 | // No other methods should be changing any of the controls directly except for helpers called by this method. | ||
1195 | // The basic pattern for programmatically changing the GUI settings is to first set the | ||
1196 | // appropriate saved settings and then call this method to sync the GUI with them. | ||
1191 | // static | 1197 | // static |
1192 | void LLFloaterSnapshot::Impl::updateControls(LLFloaterSnapshot* floater) | 1198 | void LLFloaterSnapshot::Impl::updateControls(LLFloaterSnapshot* floater) |
1193 | { | 1199 | { |
@@ -1201,15 +1207,10 @@ void LLFloaterSnapshot::Impl::updateControls(LLFloaterSnapshot* floater) | |||
1201 | floater->childSetVisible("texture_size_combo", FALSE); | 1207 | floater->childSetVisible("texture_size_combo", FALSE); |
1202 | floater->childSetVisible("local_size_combo", FALSE); | 1208 | floater->childSetVisible("local_size_combo", FALSE); |
1203 | 1209 | ||
1204 | LLComboBox* combo; | 1210 | floater->getChild<LLComboBox>("postcard_size_combo")->selectNthItem(gSavedSettings.getS32("SnapshotPostcardLastResolution")); |
1205 | combo = floater->getChild<LLComboBox>("postcard_size_combo"); | 1211 | floater->getChild<LLComboBox>("texture_size_combo")->selectNthItem(gSavedSettings.getS32("SnapshotTextureLastResolution")); |
1206 | if (combo) combo->selectNthItem(gSavedSettings.getS32("SnapshotPostcardLastResolution")); | 1212 | floater->getChild<LLComboBox>("local_size_combo")->selectNthItem(gSavedSettings.getS32("SnapshotLocalLastResolution")); |
1207 | combo = floater->getChild<LLComboBox>("texture_size_combo"); | 1213 | floater->getChild<LLComboBox>("local_format_combo")->selectNthItem(gSavedSettings.getS32("SnapshotFormat")); |
1208 | if (combo) combo->selectNthItem(gSavedSettings.getS32("SnapshotTextureLastResolution")); | ||
1209 | combo = floater->getChild<LLComboBox>("local_size_combo"); | ||
1210 | if (combo) combo->selectNthItem(gSavedSettings.getS32("SnapshotLocalLastResolution")); | ||
1211 | combo = floater->getChild<LLComboBox>("local_format_combo"); | ||
1212 | if (combo) combo->selectNthItem(gSavedSettings.getS32("SnapshotFormat")); | ||
1213 | 1214 | ||
1214 | floater->childSetVisible("upload_btn", shot_type == LLSnapshotLivePreview::SNAPSHOT_TEXTURE); | 1215 | floater->childSetVisible("upload_btn", shot_type == LLSnapshotLivePreview::SNAPSHOT_TEXTURE); |
1215 | floater->childSetVisible("send_btn", shot_type == LLSnapshotLivePreview::SNAPSHOT_POSTCARD); | 1216 | floater->childSetVisible("send_btn", shot_type == LLSnapshotLivePreview::SNAPSHOT_POSTCARD); |
@@ -1240,6 +1241,23 @@ void LLFloaterSnapshot::Impl::updateControls(LLFloaterSnapshot* floater) | |||
1240 | floater->childSetVisible("auto_snapshot_check", is_advance); | 1241 | floater->childSetVisible("auto_snapshot_check", is_advance); |
1241 | floater->childSetVisible("image_quality_slider", is_advance && show_slider); | 1242 | floater->childSetVisible("image_quality_slider", is_advance && show_slider); |
1242 | 1243 | ||
1244 | LLSnapshotLivePreview* previewp = getPreviewView(floater); | ||
1245 | BOOL got_bytes = previewp && previewp->getDataSize() > 0; | ||
1246 | BOOL got_snap = previewp->getSnapshotUpToDate(); | ||
1247 | |||
1248 | floater->childSetEnabled("send_btn", shot_type == LLSnapshotLivePreview::SNAPSHOT_POSTCARD && got_bytes && got_snap && previewp->getDataSize() <= MAX_POSTCARD_DATASIZE); | ||
1249 | floater->childSetEnabled("upload_btn", shot_type == LLSnapshotLivePreview::SNAPSHOT_TEXTURE && got_bytes && got_snap); | ||
1250 | floater->childSetEnabled("save_btn", shot_type == LLSnapshotLivePreview::SNAPSHOT_LOCAL && got_bytes && got_snap); | ||
1251 | |||
1252 | LLLocale locale(LLLocale::USER_LOCALE); | ||
1253 | std::string bytes_string; | ||
1254 | LLResMgr::getInstance()->getIntegerString(bytes_string, (previewp->getDataSize()) >> 10 ); | ||
1255 | floater->childSetTextArg("file_size_label", "[SIZE]", got_snap ? bytes_string : got_bytes ? floater->getString("unknown") : std::string("???")); | ||
1256 | floater->childSetColor("file_size_label", | ||
1257 | shot_type == LLSnapshotLivePreview::SNAPSHOT_POSTCARD | ||
1258 | && got_bytes | ||
1259 | && previewp->getDataSize() > MAX_POSTCARD_DATASIZE ? LLColor4::red : gColors.getColor( "LabelTextColor" )); | ||
1260 | |||
1243 | switch(shot_type) | 1261 | switch(shot_type) |
1244 | { | 1262 | { |
1245 | case LLSnapshotLivePreview::SNAPSHOT_POSTCARD: | 1263 | case LLSnapshotLivePreview::SNAPSHOT_POSTCARD: |
@@ -1270,7 +1288,6 @@ void LLFloaterSnapshot::Impl::updateControls(LLFloaterSnapshot* floater) | |||
1270 | 1288 | ||
1271 | updateResolutionTextEntry(floater); | 1289 | updateResolutionTextEntry(floater); |
1272 | 1290 | ||
1273 | LLSnapshotLivePreview* previewp = getPreviewView(floater); | ||
1274 | if (previewp) | 1291 | if (previewp) |
1275 | { | 1292 | { |
1276 | previewp->setSnapshotType(shot_type); | 1293 | previewp->setSnapshotType(shot_type); |
@@ -1389,6 +1406,7 @@ void LLFloaterSnapshot::Impl::onClickAutoSnap(LLUICtrl *ctrl, void* data) | |||
1389 | if (view) | 1406 | if (view) |
1390 | { | 1407 | { |
1391 | checkAutoSnapshot(getPreviewView(view)); | 1408 | checkAutoSnapshot(getPreviewView(view)); |
1409 | updateControls(view); | ||
1392 | } | 1410 | } |
1393 | } | 1411 | } |
1394 | 1412 | ||
@@ -1401,9 +1419,12 @@ void LLFloaterSnapshot::Impl::onClickMore(void* data) | |||
1401 | { | 1419 | { |
1402 | view->translate( 0, view->getUIWinHeightShort() - view->getUIWinHeightLong() ); | 1420 | view->translate( 0, view->getUIWinHeightShort() - view->getUIWinHeightLong() ); |
1403 | view->reshape(view->getRect().getWidth(), view->getUIWinHeightLong()); | 1421 | view->reshape(view->getRect().getWidth(), view->getUIWinHeightLong()); |
1404 | |||
1405 | updateControls(view) ; | 1422 | updateControls(view) ; |
1406 | updateLayout(view) ; | 1423 | updateLayout(view) ; |
1424 | if(getPreviewView(view)) | ||
1425 | { | ||
1426 | getPreviewView(view)->setThumbnailImageSize() ; | ||
1427 | } | ||
1407 | } | 1428 | } |
1408 | } | 1429 | } |
1409 | void LLFloaterSnapshot::Impl::onClickLess(void* data) | 1430 | void LLFloaterSnapshot::Impl::onClickLess(void* data) |
@@ -1415,10 +1436,8 @@ void LLFloaterSnapshot::Impl::onClickLess(void* data) | |||
1415 | { | 1436 | { |
1416 | view->translate( 0, view->getUIWinHeightLong() - view->getUIWinHeightShort() ); | 1437 | view->translate( 0, view->getUIWinHeightLong() - view->getUIWinHeightShort() ); |
1417 | view->reshape(view->getRect().getWidth(), view->getUIWinHeightShort()); | 1438 | view->reshape(view->getRect().getWidth(), view->getUIWinHeightShort()); |
1418 | |||
1419 | updateControls(view) ; | 1439 | updateControls(view) ; |
1420 | updateLayout(view) ; | 1440 | updateLayout(view) ; |
1421 | |||
1422 | if(getPreviewView(view)) | 1441 | if(getPreviewView(view)) |
1423 | { | 1442 | { |
1424 | getPreviewView(view)->setThumbnailImageSize() ; | 1443 | getPreviewView(view)->setThumbnailImageSize() ; |
@@ -1436,6 +1455,7 @@ void LLFloaterSnapshot::Impl::onClickUICheck(LLUICtrl *ctrl, void* data) | |||
1436 | if (view) | 1455 | if (view) |
1437 | { | 1456 | { |
1438 | checkAutoSnapshot(getPreviewView(view), TRUE); | 1457 | checkAutoSnapshot(getPreviewView(view), TRUE); |
1458 | updateControls(view); | ||
1439 | } | 1459 | } |
1440 | } | 1460 | } |
1441 | 1461 | ||
@@ -1449,6 +1469,7 @@ void LLFloaterSnapshot::Impl::onClickHUDCheck(LLUICtrl *ctrl, void* data) | |||
1449 | if (view) | 1469 | if (view) |
1450 | { | 1470 | { |
1451 | checkAutoSnapshot(getPreviewView(view), TRUE); | 1471 | checkAutoSnapshot(getPreviewView(view), TRUE); |
1472 | updateControls(view); | ||
1452 | } | 1473 | } |
1453 | } | 1474 | } |
1454 | 1475 | ||
@@ -1482,6 +1503,7 @@ void LLFloaterSnapshot::Impl::onClickKeepAspectCheck(LLUICtrl* ctrl, void* data) | |||
1482 | } | 1503 | } |
1483 | 1504 | ||
1484 | previewp->setSize(w, h) ; | 1505 | previewp->setSize(w, h) ; |
1506 | previewp->updateSnapshot(FALSE, TRUE); | ||
1485 | checkAutoSnapshot(previewp, TRUE); | 1507 | checkAutoSnapshot(previewp, TRUE); |
1486 | } | 1508 | } |
1487 | } | 1509 | } |
@@ -1531,7 +1553,7 @@ void LLFloaterSnapshot::Impl::checkAspectRatio(LLFloaterSnapshot *view, S32 inde | |||
1531 | } | 1553 | } |
1532 | #endif | 1554 | #endif |
1533 | 1555 | ||
1534 | if(!index) //current window size | 1556 | if(0 == index) //current window size |
1535 | { | 1557 | { |
1536 | sAspectRatioCheckOff = TRUE ; | 1558 | sAspectRatioCheckOff = TRUE ; |
1537 | view->childSetEnabled("keep_aspect_check", FALSE) ; | 1559 | view->childSetEnabled("keep_aspect_check", FALSE) ; |
@@ -1568,8 +1590,27 @@ void LLFloaterSnapshot::Impl::checkAspectRatio(LLFloaterSnapshot *view, S32 inde | |||
1568 | return ; | 1590 | return ; |
1569 | } | 1591 | } |
1570 | 1592 | ||
1593 | static std::string lastSnapshotWidthName() | ||
1594 | { | ||
1595 | switch(gSavedSettings.getS32("LastSnapshotType")) | ||
1596 | { | ||
1597 | case LLSnapshotLivePreview::SNAPSHOT_POSTCARD: return "LastSnapshotToEmailWidth"; | ||
1598 | case LLSnapshotLivePreview::SNAPSHOT_TEXTURE: return "LastSnapshotToInventoryWidth"; | ||
1599 | default: return "LastSnapshotToDiskWidth"; | ||
1600 | } | ||
1601 | } | ||
1602 | static std::string lastSnapshotHeightName() | ||
1603 | { | ||
1604 | switch(gSavedSettings.getS32("LastSnapshotType")) | ||
1605 | { | ||
1606 | case LLSnapshotLivePreview::SNAPSHOT_POSTCARD: return "LastSnapshotToEmailHeight"; | ||
1607 | case LLSnapshotLivePreview::SNAPSHOT_TEXTURE: return "LastSnapshotToInventoryHeight"; | ||
1608 | default: return "LastSnapshotToDiskHeight"; | ||
1609 | } | ||
1610 | } | ||
1611 | |||
1571 | // static | 1612 | // static |
1572 | void LLFloaterSnapshot::Impl::onCommitResolution(LLUICtrl* ctrl, void* data) | 1613 | void LLFloaterSnapshot::Impl::updateResolution(LLUICtrl* ctrl, void* data, BOOL do_update) |
1573 | { | 1614 | { |
1574 | LLComboBox* combobox = (LLComboBox*)ctrl; | 1615 | LLComboBox* combobox = (LLComboBox*)ctrl; |
1575 | LLFloaterSnapshot *view = (LLFloaterSnapshot *)data; | 1616 | LLFloaterSnapshot *view = (LLFloaterSnapshot *)data; |
@@ -1580,13 +1621,9 @@ void LLFloaterSnapshot::Impl::onCommitResolution(LLUICtrl* ctrl, void* data) | |||
1580 | } | 1621 | } |
1581 | 1622 | ||
1582 | // save off all selected resolution values | 1623 | // save off all selected resolution values |
1583 | LLComboBox* combo; | 1624 | gSavedSettings.setS32("SnapshotPostcardLastResolution", view->getChild<LLComboBox>("postcard_size_combo")->getCurrentIndex()); |
1584 | combo = view->getChild<LLComboBox>("postcard_size_combo"); | 1625 | gSavedSettings.setS32("SnapshotTextureLastResolution", view->getChild<LLComboBox>("texture_size_combo")->getCurrentIndex()); |
1585 | gSavedSettings.setS32("SnapshotPostcardLastResolution", combo->getCurrentIndex()); | 1626 | gSavedSettings.setS32("SnapshotLocalLastResolution", view->getChild<LLComboBox>("local_size_combo")->getCurrentIndex()); |
1586 | combo = view->getChild<LLComboBox>("texture_size_combo"); | ||
1587 | gSavedSettings.setS32("SnapshotTextureLastResolution", combo->getCurrentIndex()); | ||
1588 | combo = view->getChild<LLComboBox>("local_size_combo"); | ||
1589 | gSavedSettings.setS32("SnapshotLocalLastResolution", combo->getCurrentIndex()); | ||
1590 | 1627 | ||
1591 | std::string sdstring = combobox->getSelectedValue(); | 1628 | std::string sdstring = combobox->getSelectedValue(); |
1592 | LLSD sdres; | 1629 | LLSD sdres; |
@@ -1601,15 +1638,17 @@ void LLFloaterSnapshot::Impl::onCommitResolution(LLUICtrl* ctrl, void* data) | |||
1601 | { | 1638 | { |
1602 | if (width == 0 || height == 0) | 1639 | if (width == 0 || height == 0) |
1603 | { | 1640 | { |
1641 | // take resolution from current window size | ||
1604 | previewp->setSize(gViewerWindow->getWindowDisplayWidth(), gViewerWindow->getWindowDisplayHeight()); | 1642 | previewp->setSize(gViewerWindow->getWindowDisplayWidth(), gViewerWindow->getWindowDisplayHeight()); |
1605 | } | 1643 | } |
1606 | else if (width == -1 || height == -1) | 1644 | else if (width == -1 || height == -1) |
1607 | { | 1645 | { |
1608 | // load last custom value | 1646 | // load last custom value |
1609 | previewp->setSize(gSavedSettings.getS32("LastSnapshotWidth"), gSavedSettings.getS32("LastSnapshotHeight")); | 1647 | previewp->setSize(gSavedSettings.getS32(lastSnapshotWidthName()), gSavedSettings.getS32(lastSnapshotHeightName())); |
1610 | } | 1648 | } |
1611 | else | 1649 | else |
1612 | { | 1650 | { |
1651 | // use the resolution from the selected pre-canned drop-down choice | ||
1613 | previewp->setSize(width, height); | 1652 | previewp->setSize(width, height); |
1614 | } | 1653 | } |
1615 | 1654 | ||
@@ -1623,10 +1662,18 @@ void LLFloaterSnapshot::Impl::onCommitResolution(LLUICtrl* ctrl, void* data) | |||
1623 | } | 1662 | } |
1624 | previewp->setSize(width, height); | 1663 | previewp->setSize(width, height); |
1625 | 1664 | ||
1665 | if(view->childGetValue("snapshot_width").asInteger() != width || view->childGetValue("snapshot_height").asInteger() != height) | ||
1666 | { | ||
1626 | view->childSetValue("snapshot_width", width); | 1667 | view->childSetValue("snapshot_width", width); |
1627 | view->childSetValue("snapshot_height", height); | 1668 | view->childSetValue("snapshot_height", height); |
1628 | // hide old preview as the aspect ratio could be wrong | 1669 | // hide old preview as the aspect ratio could be wrong |
1629 | checkAutoSnapshot(previewp, FALSE); | 1670 | checkAutoSnapshot(previewp, FALSE); |
1671 | getPreviewView(view)->updateSnapshot(FALSE, TRUE); | ||
1672 | if(do_update) | ||
1673 | { | ||
1674 | updateControls(view); | ||
1675 | } | ||
1676 | } | ||
1630 | } | 1677 | } |
1631 | } | 1678 | } |
1632 | 1679 | ||
@@ -1675,17 +1722,28 @@ void LLFloaterSnapshot::Impl::onCommitSnapshotFormat(LLUICtrl* ctrl, void* data) | |||
1675 | 1722 | ||
1676 | 1723 | ||
1677 | 1724 | ||
1678 | 1725 | // Sets the named size combo to "custom" mode. | |
1679 | // static | 1726 | // static |
1680 | void LLFloaterSnapshot::Impl::comboSetCustom(LLFloaterSnapshot* floater, const std::string& comboname) | 1727 | void LLFloaterSnapshot::Impl::comboSetCustom(LLFloaterSnapshot* floater, const std::string& comboname) |
1681 | { | 1728 | { |
1682 | LLComboBox* combo = floater->getChild<LLComboBox>(comboname); | 1729 | LLComboBox* combo = floater->getChild<LLComboBox>(comboname); |
1683 | if (combo) | ||
1684 | { | ||
1685 | combo->setCurrentByIndex(combo->getItemCount() - 1); | ||
1686 | 1730 | ||
1687 | checkAspectRatio(floater, -1);//combo->getCurrentIndex()) ; | 1731 | combo->setCurrentByIndex(combo->getItemCount() - 1); // "custom" is always the last index |
1732 | |||
1733 | if(comboname == "postcard_size_combo") | ||
1734 | { | ||
1735 | gSavedSettings.setS32("SnapshotPostcardLastResolution", combo->getCurrentIndex()); | ||
1736 | } | ||
1737 | else if(comboname == "texture_size_combo") | ||
1738 | { | ||
1739 | gSavedSettings.setS32("SnapshotTextureLastResolution", combo->getCurrentIndex()); | ||
1688 | } | 1740 | } |
1741 | else if(comboname == "local_size_combo") | ||
1742 | { | ||
1743 | gSavedSettings.setS32("SnapshotLocalLastResolution", combo->getCurrentIndex()); | ||
1744 | } | ||
1745 | |||
1746 | checkAspectRatio(floater, -1); // -1 means custom | ||
1689 | } | 1747 | } |
1690 | 1748 | ||
1691 | 1749 | ||
@@ -1711,8 +1769,8 @@ BOOL LLFloaterSnapshot::Impl::checkImageSize(LLSnapshotLivePreview* previewp, S3 | |||
1711 | 1769 | ||
1712 | //round to nearest power of 2 based on the direction of movement | 1770 | //round to nearest power of 2 based on the direction of movement |
1713 | // i.e. higher power of two if increasing texture resolution | 1771 | // i.e. higher power of two if increasing texture resolution |
1714 | if(gSavedSettings.getS32("LastSnapshotWidth") < width || | 1772 | if(gSavedSettings.getS32("LastSnapshotToInventoryWidth") < width || |
1715 | gSavedSettings.getS32("LastSnapshotHeight") < height) | 1773 | gSavedSettings.getS32("LastSnapshotToInventoryHeight") < height) |
1716 | { | 1774 | { |
1717 | // Up arrow pressed | 1775 | // Up arrow pressed |
1718 | width = get_next_power_two(width, MAX_TEXTURE_SIZE) ; | 1776 | width = get_next_power_two(width, MAX_TEXTURE_SIZE) ; |
@@ -1772,20 +1830,10 @@ BOOL LLFloaterSnapshot::Impl::checkImageSize(LLSnapshotLivePreview* previewp, S3 | |||
1772 | //static | 1830 | //static |
1773 | void LLFloaterSnapshot::Impl::resetSnapshotSizeOnUI(LLFloaterSnapshot *view, S32 width, S32 height) | 1831 | void LLFloaterSnapshot::Impl::resetSnapshotSizeOnUI(LLFloaterSnapshot *view, S32 width, S32 height) |
1774 | { | 1832 | { |
1775 | LLSpinCtrl *sctrl = view->getChild<LLSpinCtrl>("snapshot_width") ; | 1833 | view->getChild<LLSpinCtrl>("snapshot_width")->forceSetValue(width); |
1776 | if(sctrl) | 1834 | view->getChild<LLSpinCtrl>("snapshot_height")->forceSetValue(height); |
1777 | { | 1835 | gSavedSettings.setS32(lastSnapshotWidthName(), width); |
1778 | sctrl->forceSetValue(width) ; | 1836 | gSavedSettings.setS32(lastSnapshotHeightName(), height); |
1779 | } | ||
1780 | |||
1781 | sctrl = view->getChild<LLSpinCtrl>("snapshot_height") ; | ||
1782 | if(sctrl) | ||
1783 | { | ||
1784 | sctrl->forceSetValue(height) ; | ||
1785 | } | ||
1786 | |||
1787 | gSavedSettings.setS32("LastSnapshotWidth", width); | ||
1788 | gSavedSettings.setS32("LastSnapshotHeight", height); | ||
1789 | } | 1837 | } |
1790 | 1838 | ||
1791 | //static | 1839 | //static |
@@ -1839,15 +1887,17 @@ void LLFloaterSnapshot::Impl::onCommitCustomResolution(LLUICtrl *ctrl, void* dat | |||
1839 | 1887 | ||
1840 | previewp->setSize(w,h); | 1888 | previewp->setSize(w,h); |
1841 | checkAutoSnapshot(previewp, FALSE); | 1889 | checkAutoSnapshot(previewp, FALSE); |
1890 | previewp->updateSnapshot(FALSE, TRUE); | ||
1842 | comboSetCustom(view, "postcard_size_combo"); | 1891 | comboSetCustom(view, "postcard_size_combo"); |
1843 | comboSetCustom(view, "texture_size_combo"); | 1892 | comboSetCustom(view, "texture_size_combo"); |
1844 | comboSetCustom(view, "local_size_combo"); | 1893 | comboSetCustom(view, "local_size_combo"); |
1845 | } | 1894 | } |
1846 | } | 1895 | } |
1847 | 1896 | ||
1848 | gSavedSettings.setS32("LastSnapshotWidth", w); | 1897 | gSavedSettings.setS32(lastSnapshotWidthName(), w); |
1849 | gSavedSettings.setS32("LastSnapshotHeight", h); | 1898 | gSavedSettings.setS32(lastSnapshotHeightName(), h); |
1850 | 1899 | ||
1900 | updateControls(view); | ||
1851 | } | 1901 | } |
1852 | } | 1902 | } |
1853 | 1903 | ||
@@ -1883,6 +1933,7 @@ LLFloaterSnapshot::~LLFloaterSnapshot() | |||
1883 | delete &impl; | 1933 | delete &impl; |
1884 | } | 1934 | } |
1885 | 1935 | ||
1936 | |||
1886 | BOOL LLFloaterSnapshot::postBuild() | 1937 | BOOL LLFloaterSnapshot::postBuild() |
1887 | { | 1938 | { |
1888 | childSetCommitCallback("snapshot_type_radio", Impl::onCommitSnapshotType, this); | 1939 | childSetCommitCallback("snapshot_type_radio", Impl::onCommitSnapshotType, this); |
@@ -1890,11 +1941,6 @@ BOOL LLFloaterSnapshot::postBuild() | |||
1890 | 1941 | ||
1891 | childSetAction("new_snapshot_btn", Impl::onClickNewSnapshot, this); | 1942 | childSetAction("new_snapshot_btn", Impl::onClickNewSnapshot, this); |
1892 | 1943 | ||
1893 | childSetValue("auto_snapshot_check", gSavedSettings.getBOOL("AutoSnapshot")); | ||
1894 | childSetCommitCallback("auto_snapshot_check", Impl::onClickAutoSnap, this); | ||
1895 | |||
1896 | //childSetValue("advance_snapshot_check", gSavedSettings.getBOOL("AdvanceSnapshot")); | ||
1897 | //childSetCommitCallback("advance_snapshot_check", Impl::onClickAdvanceSnap, this); | ||
1898 | childSetAction("more_btn", Impl::onClickMore, this); | 1944 | childSetAction("more_btn", Impl::onClickMore, this); |
1899 | childSetAction("less_btn", Impl::onClickLess, this); | 1945 | childSetAction("less_btn", Impl::onClickLess, this); |
1900 | 1946 | ||
@@ -1907,10 +1953,10 @@ BOOL LLFloaterSnapshot::postBuild() | |||
1907 | childSetValue("image_quality_slider", gSavedSettings.getS32("SnapshotQuality")); | 1953 | childSetValue("image_quality_slider", gSavedSettings.getS32("SnapshotQuality")); |
1908 | 1954 | ||
1909 | childSetCommitCallback("snapshot_width", Impl::onCommitCustomResolution, this); | 1955 | childSetCommitCallback("snapshot_width", Impl::onCommitCustomResolution, this); |
1910 | |||
1911 | childSetCommitCallback("snapshot_height", Impl::onCommitCustomResolution, this); | 1956 | childSetCommitCallback("snapshot_height", Impl::onCommitCustomResolution, this); |
1912 | 1957 | ||
1913 | childSetCommitCallback("ui_check", Impl::onClickUICheck, this); | 1958 | childSetCommitCallback("ui_check", Impl::onClickUICheck, this); |
1959 | childSetValue("ui_check", gSavedSettings.getBOOL("RenderUIInSnapshot")); | ||
1914 | 1960 | ||
1915 | childSetCommitCallback("hud_check", Impl::onClickHUDCheck, this); | 1961 | childSetCommitCallback("hud_check", Impl::onClickHUDCheck, this); |
1916 | childSetValue("hud_check", gSavedSettings.getBOOL("RenderHUDInSnapshot")); | 1962 | childSetValue("hud_check", gSavedSettings.getBOOL("RenderHUDInSnapshot")); |
@@ -1925,12 +1971,15 @@ BOOL LLFloaterSnapshot::postBuild() | |||
1925 | childSetValue("layer_types", "colors"); | 1971 | childSetValue("layer_types", "colors"); |
1926 | childSetEnabled("layer_types", FALSE); | 1972 | childSetEnabled("layer_types", FALSE); |
1927 | 1973 | ||
1928 | childSetValue("snapshot_width", gSavedSettings.getS32("LastSnapshotWidth")); | 1974 | childSetValue("snapshot_width", gSavedSettings.getS32(lastSnapshotWidthName())); |
1929 | childSetValue("snapshot_height", gSavedSettings.getS32("LastSnapshotHeight")); | 1975 | childSetValue("snapshot_height", gSavedSettings.getS32(lastSnapshotHeightName())); |
1930 | 1976 | ||
1931 | childSetValue("freeze_frame_check", gSavedSettings.getBOOL("UseFreezeFrame")); | 1977 | childSetValue("freeze_frame_check", gSavedSettings.getBOOL("UseFreezeFrame")); |
1932 | childSetCommitCallback("freeze_frame_check", Impl::onCommitFreezeFrame, this); | 1978 | childSetCommitCallback("freeze_frame_check", Impl::onCommitFreezeFrame, this); |
1933 | 1979 | ||
1980 | childSetValue("auto_snapshot_check", gSavedSettings.getBOOL("AutoSnapshot")); | ||
1981 | childSetCommitCallback("auto_snapshot_check", Impl::onClickAutoSnap, this); | ||
1982 | |||
1934 | childSetCommitCallback("postcard_size_combo", Impl::onCommitResolution, this); | 1983 | childSetCommitCallback("postcard_size_combo", Impl::onCommitResolution, this); |
1935 | childSetCommitCallback("texture_size_combo", Impl::onCommitResolution, this); | 1984 | childSetCommitCallback("texture_size_combo", Impl::onCommitResolution, this); |
1936 | childSetCommitCallback("local_size_combo", Impl::onCommitResolution, this); | 1985 | childSetCommitCallback("local_size_combo", Impl::onCommitResolution, this); |
@@ -1960,53 +2009,6 @@ void LLFloaterSnapshot::draw() | |||
1960 | return; | 2009 | return; |
1961 | } | 2010 | } |
1962 | 2011 | ||
1963 | if(!isMinimized()) | ||
1964 | { | ||
1965 | if (previewp && previewp->getDataSize() > 0) | ||
1966 | { | ||
1967 | LLLocale locale(LLLocale::USER_LOCALE); | ||
1968 | |||
1969 | std::string bytes_string; | ||
1970 | if (previewp->getSnapshotType() == LLSnapshotLivePreview::SNAPSHOT_POSTCARD && | ||
1971 | previewp->getDataSize() > MAX_POSTCARD_DATASIZE) | ||
1972 | { | ||
1973 | childSetColor("file_size_label", LLColor4::red); | ||
1974 | childSetEnabled("send_btn", FALSE); | ||
1975 | } | ||
1976 | else | ||
1977 | { | ||
1978 | childSetColor("file_size_label", gColors.getColor( "LabelTextColor" )); | ||
1979 | childSetEnabled("send_btn", previewp->getSnapshotUpToDate()); | ||
1980 | } | ||
1981 | |||
1982 | if (previewp->getSnapshotUpToDate()) | ||
1983 | { | ||
1984 | std::string bytes_string; | ||
1985 | LLResMgr::getInstance()->getIntegerString(bytes_string, (previewp->getDataSize()) >> 10 ); | ||
1986 | childSetTextArg("file_size_label", "[SIZE]", bytes_string); | ||
1987 | } | ||
1988 | else | ||
1989 | { | ||
1990 | childSetTextArg("file_size_label", "[SIZE]", getString("unknown")); | ||
1991 | childSetColor("file_size_label", gColors.getColor( "LabelTextColor" )); | ||
1992 | } | ||
1993 | childSetEnabled("upload_btn", previewp->getSnapshotUpToDate()); | ||
1994 | childSetEnabled("save_btn", previewp->getSnapshotUpToDate()); | ||
1995 | |||
1996 | } | ||
1997 | else | ||
1998 | { | ||
1999 | childSetTextArg("file_size_label", "[SIZE]", std::string("???")); | ||
2000 | childSetEnabled("upload_btn", FALSE); | ||
2001 | childSetEnabled("send_btn", FALSE); | ||
2002 | childSetEnabled("save_btn", FALSE); | ||
2003 | } | ||
2004 | |||
2005 | BOOL ui_in_snapshot = gSavedSettings.getBOOL("RenderUIInSnapshot"); | ||
2006 | childSetValue("ui_check", ui_in_snapshot); | ||
2007 | childSetToolTip("ui_check", std::string("If selected shows the UI in the snapshot")); | ||
2008 | } | ||
2009 | |||
2010 | LLFloater::draw(); | 2012 | LLFloater::draw(); |
2011 | 2013 | ||
2012 | if (previewp) | 2014 | if (previewp) |
@@ -2071,10 +2073,15 @@ void LLFloaterSnapshot::hide(void*) | |||
2071 | //static | 2073 | //static |
2072 | void LLFloaterSnapshot::update() | 2074 | void LLFloaterSnapshot::update() |
2073 | { | 2075 | { |
2076 | BOOL changed = FALSE; | ||
2074 | for (std::set<LLSnapshotLivePreview*>::iterator iter = LLSnapshotLivePreview::sList.begin(); | 2077 | for (std::set<LLSnapshotLivePreview*>::iterator iter = LLSnapshotLivePreview::sList.begin(); |
2075 | iter != LLSnapshotLivePreview::sList.end(); ++iter) | 2078 | iter != LLSnapshotLivePreview::sList.end(); ++iter) |
2076 | { | 2079 | { |
2077 | LLSnapshotLivePreview::onIdle(*iter); | 2080 | changed |= LLSnapshotLivePreview::onIdle(*iter); |
2081 | } | ||
2082 | if(changed) | ||
2083 | { | ||
2084 | sInstance->impl.updateControls(sInstance); | ||
2078 | } | 2085 | } |
2079 | } | 2086 | } |
2080 | 2087 | ||