diff options
author | McCabe Maxsted | 2010-09-19 08:16:14 -0700 |
---|---|---|
committer | McCabe Maxsted | 2010-09-19 08:16:14 -0700 |
commit | 7d524c7470b9846148cac9516a7686ba0d9608f7 (patch) | |
tree | 2041dce79e94e1cf52da7f874a00c622003d96c4 /linden/indra/newview/llfloatersnapshot.cpp | |
parent | Show start location on the login screen by default (diff) | |
download | meta-impy-7d524c7470b9846148cac9516a7686ba0d9608f7.zip meta-impy-7d524c7470b9846148cac9516a7686ba0d9608f7.tar.gz meta-impy-7d524c7470b9846148cac9516a7686ba0d9608f7.tar.bz2 meta-impy-7d524c7470b9846148cac9516a7686ba0d9608f7.tar.xz |
Added safety checks for when snapshot window goes out of sync with the main UI, as well as a few backported changes from Viewer 2
Diffstat (limited to '')
-rw-r--r-- | linden/indra/newview/llfloatersnapshot.cpp | 219 |
1 files changed, 121 insertions, 98 deletions
diff --git a/linden/indra/newview/llfloatersnapshot.cpp b/linden/indra/newview/llfloatersnapshot.cpp index f67340e..9e8c38b 100644 --- a/linden/indra/newview/llfloatersnapshot.cpp +++ b/linden/indra/newview/llfloatersnapshot.cpp | |||
@@ -366,6 +366,7 @@ void LLSnapshotLivePreview::setSnapshotQuality(S32 quality) | |||
366 | { | 366 | { |
367 | mSnapshotQuality = quality; | 367 | mSnapshotQuality = quality; |
368 | gSavedSettings.setS32("SnapshotQuality", quality); | 368 | gSavedSettings.setS32("SnapshotQuality", quality); |
369 | mSnapshotUpToDate = FALSE; | ||
369 | } | 370 | } |
370 | } | 371 | } |
371 | 372 | ||
@@ -777,8 +778,7 @@ BOOL LLSnapshotLivePreview::onIdle( void* snapshot_preview ) | |||
777 | previewp->getWindow()->incBusyCount(); | 778 | previewp->getWindow()->incBusyCount(); |
778 | previewp->mImageScaled[previewp->mCurImageIndex] = FALSE; | 779 | previewp->mImageScaled[previewp->mCurImageIndex] = FALSE; |
779 | 780 | ||
780 | int res = 1; | 781 | int res = (gSavedSettings.getBOOL("HighResSnapshot") && previewp->getSnapshotType() == SNAPSHOT_LOCAL) ? 2 : 1; |
781 | res = (gSavedSettings.getBOOL("HighResSnapshot") && previewp->getSnapshotType() == SNAPSHOT_LOCAL) ? 2 : 1; | ||
782 | 782 | ||
783 | if(gViewerWindow->rawSnapshot( | 783 | if(gViewerWindow->rawSnapshot( |
784 | previewp->mPreviewImage, | 784 | previewp->mPreviewImage, |
@@ -891,16 +891,16 @@ BOOL LLSnapshotLivePreview::onIdle( void* snapshot_preview ) | |||
891 | previewp->mPosTakenGlobal = gAgent.getCameraPositionGlobal(); | 891 | previewp->mPosTakenGlobal = gAgent.getCameraPositionGlobal(); |
892 | previewp->mShineCountdown = 4; // wait a few frames to avoid animation glitch due to readback this frame | 892 | previewp->mShineCountdown = 4; // wait a few frames to avoid animation glitch due to readback this frame |
893 | } | 893 | } |
894 | previewp->getWindow()->decBusyCount(); | 894 | } |
895 | // only show fullscreen preview when in freeze frame mode | 895 | previewp->getWindow()->decBusyCount(); |
896 | previewp->setVisible(gSavedSettings.getBOOL("UseFreezeFrame")); | 896 | // only show fullscreen preview when in freeze frame mode |
897 | previewp->mSnapshotDelayTimer.stop(); | 897 | previewp->setVisible(gSavedSettings.getBOOL("UseFreezeFrame")); |
898 | previewp->mSnapshotActive = FALSE; | 898 | previewp->mSnapshotDelayTimer.stop(); |
899 | previewp->mSnapshotActive = FALSE; | ||
899 | 900 | ||
900 | if(!previewp->getThumbnailUpToDate()) | 901 | if(!previewp->getThumbnailUpToDate()) |
901 | { | 902 | { |
902 | previewp->generateThumbnailImage() ; | 903 | previewp->generateThumbnailImage() ; |
903 | } | ||
904 | } | 904 | } |
905 | 905 | ||
906 | return TRUE; | 906 | return TRUE; |
@@ -1025,7 +1025,8 @@ class LLFloaterSnapshot::Impl | |||
1025 | public: | 1025 | public: |
1026 | Impl() | 1026 | Impl() |
1027 | : mAvatarPauseHandles(), | 1027 | : mAvatarPauseHandles(), |
1028 | mLastToolset(NULL) | 1028 | mLastToolset(NULL), |
1029 | mAspectRatioCheckOff(false) | ||
1029 | { | 1030 | { |
1030 | } | 1031 | } |
1031 | ~Impl() | 1032 | ~Impl() |
@@ -1064,9 +1065,6 @@ public: | |||
1064 | static void updateLayout(LLFloaterSnapshot* floater); | 1065 | static void updateLayout(LLFloaterSnapshot* floater); |
1065 | static void updateResolutionTextEntry(LLFloaterSnapshot* floater); | 1066 | static void updateResolutionTextEntry(LLFloaterSnapshot* floater); |
1066 | 1067 | ||
1067 | static LLHandle<LLView> sPreviewHandle; | ||
1068 | static BOOL sAspectRatioCheckOff ; | ||
1069 | |||
1070 | private: | 1068 | private: |
1071 | static LLSnapshotLivePreview::ESnapshotType getTypeIndex(LLFloaterSnapshot* floater); | 1069 | static LLSnapshotLivePreview::ESnapshotType getTypeIndex(LLFloaterSnapshot* floater); |
1072 | static ESnapshotFormat getFormatIndex(LLFloaterSnapshot* floater); | 1070 | static ESnapshotFormat getFormatIndex(LLFloaterSnapshot* floater); |
@@ -1079,18 +1077,14 @@ public: | |||
1079 | std::vector<LLAnimPauseRequest> mAvatarPauseHandles; | 1077 | std::vector<LLAnimPauseRequest> mAvatarPauseHandles; |
1080 | 1078 | ||
1081 | LLToolset* mLastToolset; | 1079 | LLToolset* mLastToolset; |
1080 | LLHandle<LLView> mPreviewHandle; | ||
1081 | bool mAspectRatioCheckOff ; | ||
1082 | }; | 1082 | }; |
1083 | 1083 | ||
1084 | // static | 1084 | // static |
1085 | LLHandle<LLView> LLFloaterSnapshot::Impl::sPreviewHandle; | ||
1086 | |||
1087 | //static | ||
1088 | BOOL LLFloaterSnapshot::Impl::sAspectRatioCheckOff = FALSE ; | ||
1089 | |||
1090 | // static | ||
1091 | LLSnapshotLivePreview* LLFloaterSnapshot::Impl::getPreviewView(LLFloaterSnapshot *floater) | 1085 | LLSnapshotLivePreview* LLFloaterSnapshot::Impl::getPreviewView(LLFloaterSnapshot *floater) |
1092 | { | 1086 | { |
1093 | LLSnapshotLivePreview* previewp = (LLSnapshotLivePreview*)sPreviewHandle.get(); | 1087 | LLSnapshotLivePreview* previewp = (LLSnapshotLivePreview*)floater->impl.mPreviewHandle.get(); |
1094 | return previewp; | 1088 | return previewp; |
1095 | } | 1089 | } |
1096 | 1090 | ||
@@ -1098,14 +1092,17 @@ LLSnapshotLivePreview* LLFloaterSnapshot::Impl::getPreviewView(LLFloaterSnapshot | |||
1098 | LLSnapshotLivePreview::ESnapshotType LLFloaterSnapshot::Impl::getTypeIndex(LLFloaterSnapshot* floater) | 1092 | LLSnapshotLivePreview::ESnapshotType LLFloaterSnapshot::Impl::getTypeIndex(LLFloaterSnapshot* floater) |
1099 | { | 1093 | { |
1100 | LLSnapshotLivePreview::ESnapshotType index = LLSnapshotLivePreview::SNAPSHOT_POSTCARD; | 1094 | LLSnapshotLivePreview::ESnapshotType index = LLSnapshotLivePreview::SNAPSHOT_POSTCARD; |
1101 | LLSD value = floater->childGetValue("snapshot_type_radio"); | 1095 | LLRadioGroup* snapshot_type_radio = floater->getChild<LLRadioGroup>("snapshot_type_radio"); |
1102 | const std::string id = value.asString(); | 1096 | if (snapshot_type_radio) |
1103 | if (id == "postcard") | 1097 | { |
1104 | index = LLSnapshotLivePreview::SNAPSHOT_POSTCARD; | 1098 | const std::string id = snapshot_type_radio->getSelectedValue().asString(); |
1105 | else if (id == "texture") | 1099 | if (id == "postcard") |
1106 | index = LLSnapshotLivePreview::SNAPSHOT_TEXTURE; | 1100 | index = LLSnapshotLivePreview::SNAPSHOT_POSTCARD; |
1107 | else if (id == "local") | 1101 | else if (id == "texture") |
1108 | index = LLSnapshotLivePreview::SNAPSHOT_LOCAL; | 1102 | index = LLSnapshotLivePreview::SNAPSHOT_TEXTURE; |
1103 | else if (id == "local") | ||
1104 | index = LLSnapshotLivePreview::SNAPSHOT_LOCAL; | ||
1105 | } | ||
1109 | return index; | 1106 | return index; |
1110 | } | 1107 | } |
1111 | 1108 | ||
@@ -1114,16 +1111,19 @@ LLSnapshotLivePreview::ESnapshotType LLFloaterSnapshot::Impl::getTypeIndex(LLFlo | |||
1114 | LLFloaterSnapshot::ESnapshotFormat LLFloaterSnapshot::Impl::getFormatIndex(LLFloaterSnapshot* floater) | 1111 | LLFloaterSnapshot::ESnapshotFormat LLFloaterSnapshot::Impl::getFormatIndex(LLFloaterSnapshot* floater) |
1115 | { | 1112 | { |
1116 | ESnapshotFormat index = SNAPSHOT_FORMAT_PNG; | 1113 | ESnapshotFormat index = SNAPSHOT_FORMAT_PNG; |
1117 | LLSD value = floater->childGetValue("local_format_combo"); | 1114 | if(floater->hasChild("local_format_combo")) |
1118 | const std::string id = value.asString(); | 1115 | { |
1119 | if (id == "PNG") | 1116 | LLComboBox* local_format_combo = floater->getChild<LLComboBox>("local_format_combo"); |
1120 | index = SNAPSHOT_FORMAT_PNG; | 1117 | const std::string id = local_format_combo->getSelectedItemLabel(); |
1121 | else if (id == "JPEG") | 1118 | if (id == "PNG") |
1122 | index = SNAPSHOT_FORMAT_JPEG; | 1119 | index = SNAPSHOT_FORMAT_PNG; |
1123 | else if (id == "TGA") | 1120 | else if (id == "JPEG") |
1124 | index = SNAPSHOT_FORMAT_TGA; | 1121 | index = SNAPSHOT_FORMAT_JPEG; |
1125 | else if (id == "BMP") | 1122 | else if (id == "TGA") |
1126 | index = SNAPSHOT_FORMAT_BMP; | 1123 | index = SNAPSHOT_FORMAT_TGA; |
1124 | else if (id == "BMP") | ||
1125 | index = SNAPSHOT_FORMAT_BMP; | ||
1126 | } | ||
1127 | return index; | 1127 | return index; |
1128 | } | 1128 | } |
1129 | 1129 | ||
@@ -1133,14 +1133,17 @@ LLFloaterSnapshot::ESnapshotFormat LLFloaterSnapshot::Impl::getFormatIndex(LLFlo | |||
1133 | LLViewerWindow::ESnapshotType LLFloaterSnapshot::Impl::getLayerType(LLFloaterSnapshot* floater) | 1133 | LLViewerWindow::ESnapshotType LLFloaterSnapshot::Impl::getLayerType(LLFloaterSnapshot* floater) |
1134 | { | 1134 | { |
1135 | LLViewerWindow::ESnapshotType type = LLViewerWindow::SNAPSHOT_TYPE_COLOR; | 1135 | LLViewerWindow::ESnapshotType type = LLViewerWindow::SNAPSHOT_TYPE_COLOR; |
1136 | LLSD value = floater->childGetValue("layer_types"); | 1136 | if(floater->hasChild("layer_types")) |
1137 | const std::string id = value.asString(); | 1137 | { |
1138 | if (id == "colors") | 1138 | LLComboBox* layer_types = floater->getChild<LLComboBox>("layer_types"); |
1139 | type = LLViewerWindow::SNAPSHOT_TYPE_COLOR; | 1139 | const std::string id = layer_types->getSelectedItemLabel(); |
1140 | else if (id == "depth") | 1140 | if (id == "colors") |
1141 | type = LLViewerWindow::SNAPSHOT_TYPE_DEPTH; | 1141 | type = LLViewerWindow::SNAPSHOT_TYPE_COLOR; |
1142 | else if (id == "objects") | 1142 | else if (id == "depth") |
1143 | type = LLViewerWindow::SNAPSHOT_TYPE_OBJECT_ID; | 1143 | type = LLViewerWindow::SNAPSHOT_TYPE_DEPTH; |
1144 | else if (id == "objects") | ||
1145 | type = LLViewerWindow::SNAPSHOT_TYPE_OBJECT_ID; | ||
1146 | } | ||
1144 | return type; | 1147 | return type; |
1145 | } | 1148 | } |
1146 | 1149 | ||
@@ -1199,7 +1202,7 @@ void LLFloaterSnapshot::Impl::updateLayout(LLFloaterSnapshot* floaterp) | |||
1199 | iter != LLCharacter::sInstances.end(); ++iter) | 1202 | iter != LLCharacter::sInstances.end(); ++iter) |
1200 | { | 1203 | { |
1201 | avatarp = *iter; | 1204 | avatarp = *iter; |
1202 | sInstance->impl.mAvatarPauseHandles.push_back(avatarp->requestPause()); | 1205 | floaterp->impl.mAvatarPauseHandles.push_back(avatarp->requestPause()); |
1203 | } | 1206 | } |
1204 | 1207 | ||
1205 | // freeze everything else | 1208 | // freeze everything else |
@@ -1207,7 +1210,7 @@ void LLFloaterSnapshot::Impl::updateLayout(LLFloaterSnapshot* floaterp) | |||
1207 | 1210 | ||
1208 | if (LLToolMgr::getInstance()->getCurrentToolset() != gCameraToolset) | 1211 | if (LLToolMgr::getInstance()->getCurrentToolset() != gCameraToolset) |
1209 | { | 1212 | { |
1210 | sInstance->impl.mLastToolset = LLToolMgr::getInstance()->getCurrentToolset(); | 1213 | floaterp->impl.mLastToolset = LLToolMgr::getInstance()->getCurrentToolset(); |
1211 | LLToolMgr::getInstance()->setCurrentToolset(gCameraToolset); | 1214 | LLToolMgr::getInstance()->setCurrentToolset(gCameraToolset); |
1212 | } | 1215 | } |
1213 | } | 1216 | } |
@@ -1222,15 +1225,15 @@ void LLFloaterSnapshot::Impl::updateLayout(LLFloaterSnapshot* floaterp) | |||
1222 | } | 1225 | } |
1223 | 1226 | ||
1224 | //RN: thaw all avatars | 1227 | //RN: thaw all avatars |
1225 | sInstance->impl.mAvatarPauseHandles.clear(); | 1228 | floaterp->impl.mAvatarPauseHandles.clear(); |
1226 | 1229 | ||
1227 | // thaw everything else | 1230 | // thaw everything else |
1228 | gSavedSettings.setBOOL("FreezeTime", FALSE); | 1231 | gSavedSettings.setBOOL("FreezeTime", FALSE); |
1229 | 1232 | ||
1230 | // restore last tool (e.g. pie menu, etc) | 1233 | // restore last tool (e.g. pie menu, etc) |
1231 | if (sInstance->impl.mLastToolset) | 1234 | if (floaterp->impl.mLastToolset) |
1232 | { | 1235 | { |
1233 | LLToolMgr::getInstance()->setCurrentToolset(sInstance->impl.mLastToolset); | 1236 | LLToolMgr::getInstance()->setCurrentToolset(floaterp->impl.mLastToolset); |
1234 | } | 1237 | } |
1235 | } | 1238 | } |
1236 | } | 1239 | } |
@@ -1243,8 +1246,28 @@ void LLFloaterSnapshot::Impl::updateLayout(LLFloaterSnapshot* floaterp) | |||
1243 | // static | 1246 | // static |
1244 | void LLFloaterSnapshot::Impl::updateControls(LLFloaterSnapshot* floater) | 1247 | void LLFloaterSnapshot::Impl::updateControls(LLFloaterSnapshot* floater) |
1245 | { | 1248 | { |
1249 | std::string fee = gHippoGridManager->getConnectedGrid()->getUploadFee(); | ||
1250 | floater->childSetLabelArg("upload_btn", "[UPLOADFEE]", fee); | ||
1251 | |||
1246 | LLRadioGroup* snapshot_type_radio = floater->getChild<LLRadioGroup>("snapshot_type_radio"); | 1252 | LLRadioGroup* snapshot_type_radio = floater->getChild<LLRadioGroup>("snapshot_type_radio"); |
1247 | snapshot_type_radio->setSelectedIndex(gSavedSettings.getS32("LastSnapshotType")); | 1253 | if (snapshot_type_radio) |
1254 | { | ||
1255 | snapshot_type_radio->setSelectedIndex(gSavedSettings.getS32("LastSnapshotType")); | ||
1256 | |||
1257 | const child_list_t *childs = snapshot_type_radio->getChildList(); | ||
1258 | if (childs) | ||
1259 | { | ||
1260 | child_list_t::const_iterator it, end=childs->end(); | ||
1261 | for (it=childs->begin(); it!=end; ++it) | ||
1262 | { | ||
1263 | LLRadioCtrl *ctrl = dynamic_cast<LLRadioCtrl*>(*it); | ||
1264 | if (ctrl && (ctrl->getName() == "texture")) | ||
1265 | { | ||
1266 | ctrl->setLabelArg("[UPLOADFEE]", fee); | ||
1267 | } | ||
1268 | } | ||
1269 | } | ||
1270 | } | ||
1248 | LLSnapshotLivePreview::ESnapshotType shot_type = getTypeIndex(floater); | 1271 | LLSnapshotLivePreview::ESnapshotType shot_type = getTypeIndex(floater); |
1249 | ESnapshotFormat shot_format = (ESnapshotFormat)gSavedSettings.getS32("SnapshotFormat"); //getFormatIndex(floater); LLViewerWindow::ESnapshotType layer_type = getLayerType(floater); | 1272 | ESnapshotFormat shot_format = (ESnapshotFormat)gSavedSettings.getS32("SnapshotFormat"); //getFormatIndex(floater); LLViewerWindow::ESnapshotType layer_type = getLayerType(floater); |
1250 | LLViewerWindow::ESnapshotType layer_type = getLayerType(floater); | 1273 | LLViewerWindow::ESnapshotType layer_type = getLayerType(floater); |
@@ -1258,25 +1281,10 @@ void LLFloaterSnapshot::Impl::updateControls(LLFloaterSnapshot* floater) | |||
1258 | floater->getChild<LLComboBox>("local_size_combo")->selectNthItem(gSavedSettings.getS32("SnapshotLocalLastResolution")); | 1281 | floater->getChild<LLComboBox>("local_size_combo")->selectNthItem(gSavedSettings.getS32("SnapshotLocalLastResolution")); |
1259 | floater->getChild<LLComboBox>("local_format_combo")->selectNthItem(gSavedSettings.getS32("SnapshotFormat")); | 1282 | floater->getChild<LLComboBox>("local_format_combo")->selectNthItem(gSavedSettings.getS32("SnapshotFormat")); |
1260 | 1283 | ||
1261 | std::string fee = gHippoGridManager->getConnectedGrid()->getUploadFee(); | ||
1262 | floater->childSetLabelArg("upload_btn", "[UPLOADFEE]", fee); | ||
1263 | |||
1264 | if (snapshot_type_radio) { | ||
1265 | const child_list_t *childs = snapshot_type_radio->getChildList(); | ||
1266 | if (childs) { | ||
1267 | child_list_t::const_iterator it, end=childs->end(); | ||
1268 | for (it=childs->begin(); it!=end; ++it) { | ||
1269 | LLRadioCtrl *ctrl = dynamic_cast<LLRadioCtrl*>(*it); | ||
1270 | if (ctrl && (ctrl->getName() == "texture")) | ||
1271 | ctrl->setLabelArg("[UPLOADFEE]", fee); | ||
1272 | } | ||
1273 | } | ||
1274 | } | ||
1275 | |||
1276 | floater->childSetVisible("upload_btn", shot_type == LLSnapshotLivePreview::SNAPSHOT_TEXTURE); | 1284 | floater->childSetVisible("upload_btn", shot_type == LLSnapshotLivePreview::SNAPSHOT_TEXTURE); |
1277 | floater->childSetVisible("send_btn", shot_type == LLSnapshotLivePreview::SNAPSHOT_POSTCARD); | 1285 | floater->childSetVisible("send_btn", shot_type == LLSnapshotLivePreview::SNAPSHOT_POSTCARD); |
1278 | floater->childSetVisible("save_btn", shot_type == LLSnapshotLivePreview::SNAPSHOT_LOCAL); | 1286 | floater->childSetVisible("save_btn", shot_type == LLSnapshotLivePreview::SNAPSHOT_LOCAL); |
1279 | floater->childSetEnabled("keep_aspect_check", shot_type != LLSnapshotLivePreview::SNAPSHOT_TEXTURE && !sAspectRatioCheckOff); | 1287 | floater->childSetEnabled("keep_aspect_check", shot_type != LLSnapshotLivePreview::SNAPSHOT_TEXTURE && !floater->impl.mAspectRatioCheckOff); |
1280 | floater->childSetEnabled("layer_types", shot_type == LLSnapshotLivePreview::SNAPSHOT_LOCAL); | 1288 | floater->childSetEnabled("layer_types", shot_type == LLSnapshotLivePreview::SNAPSHOT_LOCAL); |
1281 | if(shot_type != LLSnapshotLivePreview::SNAPSHOT_TEXTURE) | 1289 | if(shot_type != LLSnapshotLivePreview::SNAPSHOT_TEXTURE) |
1282 | { | 1290 | { |
@@ -1308,7 +1316,7 @@ void LLFloaterSnapshot::Impl::updateControls(LLFloaterSnapshot* floater) | |||
1308 | 1316 | ||
1309 | LLSnapshotLivePreview* previewp = getPreviewView(floater); | 1317 | LLSnapshotLivePreview* previewp = getPreviewView(floater); |
1310 | BOOL got_bytes = previewp && previewp->getDataSize() > 0; | 1318 | BOOL got_bytes = previewp && previewp->getDataSize() > 0; |
1311 | BOOL got_snap = previewp->getSnapshotUpToDate(); | 1319 | BOOL got_snap = previewp && previewp->getSnapshotUpToDate(); |
1312 | 1320 | ||
1313 | BOOL show_slider = | 1321 | BOOL show_slider = |
1314 | shot_type == LLSnapshotLivePreview::SNAPSHOT_POSTCARD | 1322 | shot_type == LLSnapshotLivePreview::SNAPSHOT_POSTCARD |
@@ -1321,7 +1329,10 @@ void LLFloaterSnapshot::Impl::updateControls(LLFloaterSnapshot* floater) | |||
1321 | 1329 | ||
1322 | LLLocale locale(LLLocale::USER_LOCALE); | 1330 | LLLocale locale(LLLocale::USER_LOCALE); |
1323 | std::string bytes_string; | 1331 | std::string bytes_string; |
1324 | LLResMgr::getInstance()->getIntegerString(bytes_string, (previewp->getDataSize()) >> 10 ); | 1332 | if (got_snap) |
1333 | { | ||
1334 | LLResMgr::getInstance()->getIntegerString(bytes_string, (previewp->getDataSize()) >> 10 ); | ||
1335 | } | ||
1325 | S32 upload_cost = LLGlobalEconomy::Singleton::getInstance()->getPriceUpload(); | 1336 | S32 upload_cost = LLGlobalEconomy::Singleton::getInstance()->getPriceUpload(); |
1326 | floater->childSetLabelArg("texture", "[AMOUNT]", llformat("%d",upload_cost)); | 1337 | floater->childSetLabelArg("texture", "[AMOUNT]", llformat("%d",upload_cost)); |
1327 | floater->childSetLabelArg("upload_btn", "[AMOUNT]", llformat("%d",upload_cost)); | 1338 | floater->childSetLabelArg("upload_btn", "[AMOUNT]", llformat("%d",upload_cost)); |
@@ -1652,7 +1663,7 @@ void LLFloaterSnapshot::Impl::checkAspectRatio(LLFloaterSnapshot *view, S32 inde | |||
1652 | 1663 | ||
1653 | if(0 == index) //current window size | 1664 | if(0 == index) //current window size |
1654 | { | 1665 | { |
1655 | sAspectRatioCheckOff = TRUE ; | 1666 | view->impl.mAspectRatioCheckOff = true ; |
1656 | view->childSetEnabled("keep_aspect_check", FALSE) ; | 1667 | view->childSetEnabled("keep_aspect_check", FALSE) ; |
1657 | 1668 | ||
1658 | if(previewp) | 1669 | if(previewp) |
@@ -1662,7 +1673,7 @@ void LLFloaterSnapshot::Impl::checkAspectRatio(LLFloaterSnapshot *view, S32 inde | |||
1662 | } | 1673 | } |
1663 | else if(-1 == index) //custom | 1674 | else if(-1 == index) //custom |
1664 | { | 1675 | { |
1665 | sAspectRatioCheckOff = FALSE ; | 1676 | view->impl.mAspectRatioCheckOff = false ; |
1666 | //if(LLSnapshotLivePreview::SNAPSHOT_TEXTURE != gSavedSettings.getS32("LastSnapshotType")) | 1677 | //if(LLSnapshotLivePreview::SNAPSHOT_TEXTURE != gSavedSettings.getS32("LastSnapshotType")) |
1667 | { | 1678 | { |
1668 | view->childSetEnabled("keep_aspect_check", TRUE) ; | 1679 | view->childSetEnabled("keep_aspect_check", TRUE) ; |
@@ -1675,7 +1686,7 @@ void LLFloaterSnapshot::Impl::checkAspectRatio(LLFloaterSnapshot *view, S32 inde | |||
1675 | } | 1686 | } |
1676 | else | 1687 | else |
1677 | { | 1688 | { |
1678 | sAspectRatioCheckOff = TRUE ; | 1689 | view->impl.mAspectRatioCheckOff = true ; |
1679 | view->childSetEnabled("keep_aspect_check", FALSE) ; | 1690 | view->childSetEnabled("keep_aspect_check", FALSE) ; |
1680 | 1691 | ||
1681 | if(previewp) | 1692 | if(previewp) |
@@ -1832,23 +1843,25 @@ void LLFloaterSnapshot::Impl::onCommitSnapshotFormat(LLUICtrl* ctrl, void* data) | |||
1832 | void LLFloaterSnapshot::Impl::comboSetCustom(LLFloaterSnapshot* floater, const std::string& comboname) | 1843 | void LLFloaterSnapshot::Impl::comboSetCustom(LLFloaterSnapshot* floater, const std::string& comboname) |
1833 | { | 1844 | { |
1834 | LLComboBox* combo = floater->getChild<LLComboBox>(comboname); | 1845 | LLComboBox* combo = floater->getChild<LLComboBox>(comboname); |
1846 | if (combo) | ||
1847 | { | ||
1848 | combo->setCurrentByIndex(combo->getItemCount() - 1); // "custom" is always the last index | ||
1835 | 1849 | ||
1836 | combo->setCurrentByIndex(combo->getItemCount() - 1); // "custom" is always the last index | 1850 | if(comboname == "postcard_size_combo") |
1851 | { | ||
1852 | gSavedSettings.setS32("SnapshotPostcardLastResolution", combo->getCurrentIndex()); | ||
1853 | } | ||
1854 | else if(comboname == "texture_size_combo") | ||
1855 | { | ||
1856 | gSavedSettings.setS32("SnapshotTextureLastResolution", combo->getCurrentIndex()); | ||
1857 | } | ||
1858 | else if(comboname == "local_size_combo") | ||
1859 | { | ||
1860 | gSavedSettings.setS32("SnapshotLocalLastResolution", combo->getCurrentIndex()); | ||
1861 | } | ||
1837 | 1862 | ||
1838 | if(comboname == "postcard_size_combo") | 1863 | checkAspectRatio(floater, -1); // -1 means custom |
1839 | { | ||
1840 | gSavedSettings.setS32("SnapshotPostcardLastResolution", combo->getCurrentIndex()); | ||
1841 | } | ||
1842 | else if(comboname == "texture_size_combo") | ||
1843 | { | ||
1844 | gSavedSettings.setS32("SnapshotTextureLastResolution", combo->getCurrentIndex()); | ||
1845 | } | 1864 | } |
1846 | else if(comboname == "local_size_combo") | ||
1847 | { | ||
1848 | gSavedSettings.setS32("SnapshotLocalLastResolution", combo->getCurrentIndex()); | ||
1849 | } | ||
1850 | |||
1851 | checkAspectRatio(floater, -1); // -1 means custom | ||
1852 | } | 1865 | } |
1853 | 1866 | ||
1854 | 1867 | ||
@@ -2015,6 +2028,7 @@ LLFloaterSnapshot::LLFloaterSnapshot() | |||
2015 | : LLFloater(std::string("Snapshot Floater")), | 2028 | : LLFloater(std::string("Snapshot Floater")), |
2016 | impl (*(new Impl)) | 2029 | impl (*(new Impl)) |
2017 | { | 2030 | { |
2031 | //Called from floater reg: LLUICtrlFactory::getInstance()->buildFloater(this, "floater_snapshot.xml", FALSE); | ||
2018 | } | 2032 | } |
2019 | 2033 | ||
2020 | // Destroys the object | 2034 | // Destroys the object |
@@ -2022,8 +2036,7 @@ LLFloaterSnapshot::~LLFloaterSnapshot() | |||
2022 | { | 2036 | { |
2023 | if (sInstance == this) | 2037 | if (sInstance == this) |
2024 | { | 2038 | { |
2025 | LLView::deleteViewByHandle(Impl::sPreviewHandle); | 2039 | LLView::deleteViewByHandle(impl.mPreviewHandle); |
2026 | Impl::sPreviewHandle = LLHandle<LLView>(); | ||
2027 | sInstance = NULL; | 2040 | sInstance = NULL; |
2028 | } | 2041 | } |
2029 | 2042 | ||
@@ -2092,20 +2105,27 @@ BOOL LLFloaterSnapshot::postBuild() | |||
2092 | childSetCommitCallback("texture_size_combo", Impl::onCommitResolution, this); | 2105 | childSetCommitCallback("texture_size_combo", Impl::onCommitResolution, this); |
2093 | childSetCommitCallback("local_size_combo", Impl::onCommitResolution, this); | 2106 | childSetCommitCallback("local_size_combo", Impl::onCommitResolution, this); |
2094 | 2107 | ||
2108 | gSavedSettings.setBOOL("EmeraldTemporaryUpload",FALSE); | ||
2109 | childSetValue("temp_check",FALSE); | ||
2110 | |||
2095 | // create preview window | 2111 | // create preview window |
2096 | LLRect full_screen_rect = sInstance->getRootView()->getRect(); | 2112 | LLRect full_screen_rect = getRootView()->getRect(); |
2097 | LLSnapshotLivePreview* previewp = new LLSnapshotLivePreview(full_screen_rect); | 2113 | LLSnapshotLivePreview* previewp = new LLSnapshotLivePreview(full_screen_rect); |
2098 | sInstance->getRootView()->removeChild(gSnapshotFloaterView); | 2114 | LLView* parent_view = gSnapshotFloaterView->getParent(); |
2115 | |||
2116 | parent_view->removeChild(gSnapshotFloaterView); | ||
2099 | // make sure preview is below snapshot floater | 2117 | // make sure preview is below snapshot floater |
2100 | sInstance->getRootView()->addChild(previewp); | 2118 | parent_view->addChild(previewp); |
2101 | sInstance->getRootView()->addChild(gSnapshotFloaterView); | 2119 | parent_view->addChild(gSnapshotFloaterView); |
2102 | 2120 | ||
2103 | gSavedSettings.setBOOL("EmeraldTemporaryUpload",FALSE); | 2121 | impl.mPreviewHandle = previewp->getHandle(); |
2104 | childSetValue("temp_check",FALSE); | ||
2105 | 2122 | ||
2106 | Impl::sPreviewHandle = previewp->getHandle(); | 2123 | //move snapshot floater to special purpose snapshotfloaterview |
2124 | //gFloaterView->removeChild(this); | ||
2125 | //gSnapshotFloaterView->addChild(this); | ||
2107 | 2126 | ||
2108 | impl.updateControls(this); | 2127 | impl.updateControls(this); |
2128 | impl.updateLayout(this); | ||
2109 | 2129 | ||
2110 | return TRUE; | 2130 | return TRUE; |
2111 | } | 2131 | } |
@@ -2282,6 +2302,9 @@ void LLFloaterSnapshot::hide(void*) | |||
2282 | //static | 2302 | //static |
2283 | void LLFloaterSnapshot::update() | 2303 | void LLFloaterSnapshot::update() |
2284 | { | 2304 | { |
2305 | if (!sInstance) | ||
2306 | return; | ||
2307 | |||
2285 | BOOL changed = FALSE; | 2308 | BOOL changed = FALSE; |
2286 | for (std::set<LLSnapshotLivePreview*>::iterator iter = LLSnapshotLivePreview::sList.begin(); | 2309 | for (std::set<LLSnapshotLivePreview*>::iterator iter = LLSnapshotLivePreview::sList.begin(); |
2287 | iter != LLSnapshotLivePreview::sList.end(); ++iter) | 2310 | iter != LLSnapshotLivePreview::sList.end(); ++iter) |