diff options
Diffstat (limited to '')
-rw-r--r-- | linden/indra/newview/llfloatersnapshot.cpp | 237 |
1 files changed, 134 insertions, 103 deletions
diff --git a/linden/indra/newview/llfloatersnapshot.cpp b/linden/indra/newview/llfloatersnapshot.cpp index f67340e..c0e972d 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 | ||
@@ -737,7 +738,10 @@ BOOL LLSnapshotLivePreview::onIdle( void* snapshot_preview ) | |||
737 | 738 | ||
738 | LLVector3 new_camera_pos = LLViewerCamera::getInstance()->getOrigin(); | 739 | LLVector3 new_camera_pos = LLViewerCamera::getInstance()->getOrigin(); |
739 | LLQuaternion new_camera_rot = LLViewerCamera::getInstance()->getQuaternion(); | 740 | LLQuaternion new_camera_rot = LLViewerCamera::getInstance()->getQuaternion(); |
740 | if (gSavedSettings.getBOOL("FreezeTime") && | 741 | |
742 | static BOOL* sFreezeTime = rebind_llcontrol<BOOL>("FreezeTime", &gSavedSettings, true); | ||
743 | |||
744 | if ((*sFreezeTime) && | ||
741 | (new_camera_pos != previewp->mCameraPos || dot(new_camera_rot, previewp->mCameraRot) < 0.995f)) | 745 | (new_camera_pos != previewp->mCameraPos || dot(new_camera_rot, previewp->mCameraRot) < 0.995f)) |
742 | { | 746 | { |
743 | previewp->mCameraPos = new_camera_pos; | 747 | previewp->mCameraPos = new_camera_pos; |
@@ -777,8 +781,7 @@ BOOL LLSnapshotLivePreview::onIdle( void* snapshot_preview ) | |||
777 | previewp->getWindow()->incBusyCount(); | 781 | previewp->getWindow()->incBusyCount(); |
778 | previewp->mImageScaled[previewp->mCurImageIndex] = FALSE; | 782 | previewp->mImageScaled[previewp->mCurImageIndex] = FALSE; |
779 | 783 | ||
780 | int res = 1; | 784 | int res = (gSavedSettings.getBOOL("HighResSnapshot") && previewp->getSnapshotType() == SNAPSHOT_LOCAL) ? 2 : 1; |
781 | res = (gSavedSettings.getBOOL("HighResSnapshot") && previewp->getSnapshotType() == SNAPSHOT_LOCAL) ? 2 : 1; | ||
782 | 785 | ||
783 | if(gViewerWindow->rawSnapshot( | 786 | if(gViewerWindow->rawSnapshot( |
784 | previewp->mPreviewImage, | 787 | previewp->mPreviewImage, |
@@ -891,16 +894,16 @@ BOOL LLSnapshotLivePreview::onIdle( void* snapshot_preview ) | |||
891 | previewp->mPosTakenGlobal = gAgent.getCameraPositionGlobal(); | 894 | previewp->mPosTakenGlobal = gAgent.getCameraPositionGlobal(); |
892 | previewp->mShineCountdown = 4; // wait a few frames to avoid animation glitch due to readback this frame | 895 | previewp->mShineCountdown = 4; // wait a few frames to avoid animation glitch due to readback this frame |
893 | } | 896 | } |
894 | previewp->getWindow()->decBusyCount(); | 897 | } |
895 | // only show fullscreen preview when in freeze frame mode | 898 | previewp->getWindow()->decBusyCount(); |
896 | previewp->setVisible(gSavedSettings.getBOOL("UseFreezeFrame")); | 899 | // only show fullscreen preview when in freeze frame mode |
897 | previewp->mSnapshotDelayTimer.stop(); | 900 | previewp->setVisible(gSavedSettings.getBOOL("UseFreezeFrame")); |
898 | previewp->mSnapshotActive = FALSE; | 901 | previewp->mSnapshotDelayTimer.stop(); |
902 | previewp->mSnapshotActive = FALSE; | ||
899 | 903 | ||
900 | if(!previewp->getThumbnailUpToDate()) | 904 | if(!previewp->getThumbnailUpToDate()) |
901 | { | 905 | { |
902 | previewp->generateThumbnailImage() ; | 906 | previewp->generateThumbnailImage() ; |
903 | } | ||
904 | } | 907 | } |
905 | 908 | ||
906 | return TRUE; | 909 | return TRUE; |
@@ -1025,7 +1028,8 @@ class LLFloaterSnapshot::Impl | |||
1025 | public: | 1028 | public: |
1026 | Impl() | 1029 | Impl() |
1027 | : mAvatarPauseHandles(), | 1030 | : mAvatarPauseHandles(), |
1028 | mLastToolset(NULL) | 1031 | mLastToolset(NULL), |
1032 | mAspectRatioCheckOff(false) | ||
1029 | { | 1033 | { |
1030 | } | 1034 | } |
1031 | ~Impl() | 1035 | ~Impl() |
@@ -1064,9 +1068,6 @@ public: | |||
1064 | static void updateLayout(LLFloaterSnapshot* floater); | 1068 | static void updateLayout(LLFloaterSnapshot* floater); |
1065 | static void updateResolutionTextEntry(LLFloaterSnapshot* floater); | 1069 | static void updateResolutionTextEntry(LLFloaterSnapshot* floater); |
1066 | 1070 | ||
1067 | static LLHandle<LLView> sPreviewHandle; | ||
1068 | static BOOL sAspectRatioCheckOff ; | ||
1069 | |||
1070 | private: | 1071 | private: |
1071 | static LLSnapshotLivePreview::ESnapshotType getTypeIndex(LLFloaterSnapshot* floater); | 1072 | static LLSnapshotLivePreview::ESnapshotType getTypeIndex(LLFloaterSnapshot* floater); |
1072 | static ESnapshotFormat getFormatIndex(LLFloaterSnapshot* floater); | 1073 | static ESnapshotFormat getFormatIndex(LLFloaterSnapshot* floater); |
@@ -1079,18 +1080,14 @@ public: | |||
1079 | std::vector<LLAnimPauseRequest> mAvatarPauseHandles; | 1080 | std::vector<LLAnimPauseRequest> mAvatarPauseHandles; |
1080 | 1081 | ||
1081 | LLToolset* mLastToolset; | 1082 | LLToolset* mLastToolset; |
1083 | LLHandle<LLView> mPreviewHandle; | ||
1084 | bool mAspectRatioCheckOff ; | ||
1082 | }; | 1085 | }; |
1083 | 1086 | ||
1084 | // static | 1087 | // 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) | 1088 | LLSnapshotLivePreview* LLFloaterSnapshot::Impl::getPreviewView(LLFloaterSnapshot *floater) |
1092 | { | 1089 | { |
1093 | LLSnapshotLivePreview* previewp = (LLSnapshotLivePreview*)sPreviewHandle.get(); | 1090 | LLSnapshotLivePreview* previewp = (LLSnapshotLivePreview*)floater->impl.mPreviewHandle.get(); |
1094 | return previewp; | 1091 | return previewp; |
1095 | } | 1092 | } |
1096 | 1093 | ||
@@ -1098,14 +1095,17 @@ LLSnapshotLivePreview* LLFloaterSnapshot::Impl::getPreviewView(LLFloaterSnapshot | |||
1098 | LLSnapshotLivePreview::ESnapshotType LLFloaterSnapshot::Impl::getTypeIndex(LLFloaterSnapshot* floater) | 1095 | LLSnapshotLivePreview::ESnapshotType LLFloaterSnapshot::Impl::getTypeIndex(LLFloaterSnapshot* floater) |
1099 | { | 1096 | { |
1100 | LLSnapshotLivePreview::ESnapshotType index = LLSnapshotLivePreview::SNAPSHOT_POSTCARD; | 1097 | LLSnapshotLivePreview::ESnapshotType index = LLSnapshotLivePreview::SNAPSHOT_POSTCARD; |
1101 | LLSD value = floater->childGetValue("snapshot_type_radio"); | 1098 | LLRadioGroup* snapshot_type_radio = floater->getChild<LLRadioGroup>("snapshot_type_radio"); |
1102 | const std::string id = value.asString(); | 1099 | if (snapshot_type_radio) |
1103 | if (id == "postcard") | 1100 | { |
1104 | index = LLSnapshotLivePreview::SNAPSHOT_POSTCARD; | 1101 | const std::string id = snapshot_type_radio->getSelectedValue().asString(); |
1105 | else if (id == "texture") | 1102 | if (id == "postcard") |
1106 | index = LLSnapshotLivePreview::SNAPSHOT_TEXTURE; | 1103 | index = LLSnapshotLivePreview::SNAPSHOT_POSTCARD; |
1107 | else if (id == "local") | 1104 | else if (id == "texture") |
1108 | index = LLSnapshotLivePreview::SNAPSHOT_LOCAL; | 1105 | index = LLSnapshotLivePreview::SNAPSHOT_TEXTURE; |
1106 | else if (id == "local") | ||
1107 | index = LLSnapshotLivePreview::SNAPSHOT_LOCAL; | ||
1108 | } | ||
1109 | return index; | 1109 | return index; |
1110 | } | 1110 | } |
1111 | 1111 | ||
@@ -1114,16 +1114,19 @@ LLSnapshotLivePreview::ESnapshotType LLFloaterSnapshot::Impl::getTypeIndex(LLFlo | |||
1114 | LLFloaterSnapshot::ESnapshotFormat LLFloaterSnapshot::Impl::getFormatIndex(LLFloaterSnapshot* floater) | 1114 | LLFloaterSnapshot::ESnapshotFormat LLFloaterSnapshot::Impl::getFormatIndex(LLFloaterSnapshot* floater) |
1115 | { | 1115 | { |
1116 | ESnapshotFormat index = SNAPSHOT_FORMAT_PNG; | 1116 | ESnapshotFormat index = SNAPSHOT_FORMAT_PNG; |
1117 | LLSD value = floater->childGetValue("local_format_combo"); | 1117 | if(floater->hasChild("local_format_combo")) |
1118 | const std::string id = value.asString(); | 1118 | { |
1119 | if (id == "PNG") | 1119 | LLComboBox* local_format_combo = floater->getChild<LLComboBox>("local_format_combo"); |
1120 | index = SNAPSHOT_FORMAT_PNG; | 1120 | const std::string id = local_format_combo->getSelectedItemLabel(); |
1121 | else if (id == "JPEG") | 1121 | if (id == "PNG") |
1122 | index = SNAPSHOT_FORMAT_JPEG; | 1122 | index = SNAPSHOT_FORMAT_PNG; |
1123 | else if (id == "TGA") | 1123 | else if (id == "JPEG") |
1124 | index = SNAPSHOT_FORMAT_TGA; | 1124 | index = SNAPSHOT_FORMAT_JPEG; |
1125 | else if (id == "BMP") | 1125 | else if (id == "TGA") |
1126 | index = SNAPSHOT_FORMAT_BMP; | 1126 | index = SNAPSHOT_FORMAT_TGA; |
1127 | else if (id == "BMP") | ||
1128 | index = SNAPSHOT_FORMAT_BMP; | ||
1129 | } | ||
1127 | return index; | 1130 | return index; |
1128 | } | 1131 | } |
1129 | 1132 | ||
@@ -1133,14 +1136,17 @@ LLFloaterSnapshot::ESnapshotFormat LLFloaterSnapshot::Impl::getFormatIndex(LLFlo | |||
1133 | LLViewerWindow::ESnapshotType LLFloaterSnapshot::Impl::getLayerType(LLFloaterSnapshot* floater) | 1136 | LLViewerWindow::ESnapshotType LLFloaterSnapshot::Impl::getLayerType(LLFloaterSnapshot* floater) |
1134 | { | 1137 | { |
1135 | LLViewerWindow::ESnapshotType type = LLViewerWindow::SNAPSHOT_TYPE_COLOR; | 1138 | LLViewerWindow::ESnapshotType type = LLViewerWindow::SNAPSHOT_TYPE_COLOR; |
1136 | LLSD value = floater->childGetValue("layer_types"); | 1139 | if(floater->hasChild("layer_types")) |
1137 | const std::string id = value.asString(); | 1140 | { |
1138 | if (id == "colors") | 1141 | LLComboBox* layer_types = floater->getChild<LLComboBox>("layer_types"); |
1139 | type = LLViewerWindow::SNAPSHOT_TYPE_COLOR; | 1142 | const std::string id = layer_types->getSelectedItemLabel(); |
1140 | else if (id == "depth") | 1143 | if (id == "colors") |
1141 | type = LLViewerWindow::SNAPSHOT_TYPE_DEPTH; | 1144 | type = LLViewerWindow::SNAPSHOT_TYPE_COLOR; |
1142 | else if (id == "objects") | 1145 | else if (id == "depth") |
1143 | type = LLViewerWindow::SNAPSHOT_TYPE_OBJECT_ID; | 1146 | type = LLViewerWindow::SNAPSHOT_TYPE_DEPTH; |
1147 | else if (id == "objects") | ||
1148 | type = LLViewerWindow::SNAPSHOT_TYPE_OBJECT_ID; | ||
1149 | } | ||
1144 | return type; | 1150 | return type; |
1145 | } | 1151 | } |
1146 | 1152 | ||
@@ -1199,7 +1205,7 @@ void LLFloaterSnapshot::Impl::updateLayout(LLFloaterSnapshot* floaterp) | |||
1199 | iter != LLCharacter::sInstances.end(); ++iter) | 1205 | iter != LLCharacter::sInstances.end(); ++iter) |
1200 | { | 1206 | { |
1201 | avatarp = *iter; | 1207 | avatarp = *iter; |
1202 | sInstance->impl.mAvatarPauseHandles.push_back(avatarp->requestPause()); | 1208 | floaterp->impl.mAvatarPauseHandles.push_back(avatarp->requestPause()); |
1203 | } | 1209 | } |
1204 | 1210 | ||
1205 | // freeze everything else | 1211 | // freeze everything else |
@@ -1207,7 +1213,7 @@ void LLFloaterSnapshot::Impl::updateLayout(LLFloaterSnapshot* floaterp) | |||
1207 | 1213 | ||
1208 | if (LLToolMgr::getInstance()->getCurrentToolset() != gCameraToolset) | 1214 | if (LLToolMgr::getInstance()->getCurrentToolset() != gCameraToolset) |
1209 | { | 1215 | { |
1210 | sInstance->impl.mLastToolset = LLToolMgr::getInstance()->getCurrentToolset(); | 1216 | floaterp->impl.mLastToolset = LLToolMgr::getInstance()->getCurrentToolset(); |
1211 | LLToolMgr::getInstance()->setCurrentToolset(gCameraToolset); | 1217 | LLToolMgr::getInstance()->setCurrentToolset(gCameraToolset); |
1212 | } | 1218 | } |
1213 | } | 1219 | } |
@@ -1222,15 +1228,15 @@ void LLFloaterSnapshot::Impl::updateLayout(LLFloaterSnapshot* floaterp) | |||
1222 | } | 1228 | } |
1223 | 1229 | ||
1224 | //RN: thaw all avatars | 1230 | //RN: thaw all avatars |
1225 | sInstance->impl.mAvatarPauseHandles.clear(); | 1231 | floaterp->impl.mAvatarPauseHandles.clear(); |
1226 | 1232 | ||
1227 | // thaw everything else | 1233 | // thaw everything else |
1228 | gSavedSettings.setBOOL("FreezeTime", FALSE); | 1234 | gSavedSettings.setBOOL("FreezeTime", FALSE); |
1229 | 1235 | ||
1230 | // restore last tool (e.g. pie menu, etc) | 1236 | // restore last tool (e.g. pie menu, etc) |
1231 | if (sInstance->impl.mLastToolset) | 1237 | if (floaterp->impl.mLastToolset) |
1232 | { | 1238 | { |
1233 | LLToolMgr::getInstance()->setCurrentToolset(sInstance->impl.mLastToolset); | 1239 | LLToolMgr::getInstance()->setCurrentToolset(floaterp->impl.mLastToolset); |
1234 | } | 1240 | } |
1235 | } | 1241 | } |
1236 | } | 1242 | } |
@@ -1243,8 +1249,28 @@ void LLFloaterSnapshot::Impl::updateLayout(LLFloaterSnapshot* floaterp) | |||
1243 | // static | 1249 | // static |
1244 | void LLFloaterSnapshot::Impl::updateControls(LLFloaterSnapshot* floater) | 1250 | void LLFloaterSnapshot::Impl::updateControls(LLFloaterSnapshot* floater) |
1245 | { | 1251 | { |
1252 | std::string fee = gHippoGridManager->getConnectedGrid()->getUploadFee(); | ||
1253 | floater->childSetLabelArg("upload_btn", "[UPLOADFEE]", fee); | ||
1254 | |||
1246 | LLRadioGroup* snapshot_type_radio = floater->getChild<LLRadioGroup>("snapshot_type_radio"); | 1255 | LLRadioGroup* snapshot_type_radio = floater->getChild<LLRadioGroup>("snapshot_type_radio"); |
1247 | snapshot_type_radio->setSelectedIndex(gSavedSettings.getS32("LastSnapshotType")); | 1256 | if (snapshot_type_radio) |
1257 | { | ||
1258 | snapshot_type_radio->setSelectedIndex(gSavedSettings.getS32("LastSnapshotType")); | ||
1259 | |||
1260 | const child_list_t *childs = snapshot_type_radio->getChildList(); | ||
1261 | if (childs) | ||
1262 | { | ||
1263 | child_list_t::const_iterator it, end=childs->end(); | ||
1264 | for (it=childs->begin(); it!=end; ++it) | ||
1265 | { | ||
1266 | LLRadioCtrl *ctrl = dynamic_cast<LLRadioCtrl*>(*it); | ||
1267 | if (ctrl && (ctrl->getName() == "texture")) | ||
1268 | { | ||
1269 | ctrl->setLabelArg("[UPLOADFEE]", fee); | ||
1270 | } | ||
1271 | } | ||
1272 | } | ||
1273 | } | ||
1248 | LLSnapshotLivePreview::ESnapshotType shot_type = getTypeIndex(floater); | 1274 | LLSnapshotLivePreview::ESnapshotType shot_type = getTypeIndex(floater); |
1249 | ESnapshotFormat shot_format = (ESnapshotFormat)gSavedSettings.getS32("SnapshotFormat"); //getFormatIndex(floater); LLViewerWindow::ESnapshotType layer_type = getLayerType(floater); | 1275 | ESnapshotFormat shot_format = (ESnapshotFormat)gSavedSettings.getS32("SnapshotFormat"); //getFormatIndex(floater); LLViewerWindow::ESnapshotType layer_type = getLayerType(floater); |
1250 | LLViewerWindow::ESnapshotType layer_type = getLayerType(floater); | 1276 | LLViewerWindow::ESnapshotType layer_type = getLayerType(floater); |
@@ -1258,25 +1284,10 @@ void LLFloaterSnapshot::Impl::updateControls(LLFloaterSnapshot* floater) | |||
1258 | floater->getChild<LLComboBox>("local_size_combo")->selectNthItem(gSavedSettings.getS32("SnapshotLocalLastResolution")); | 1284 | floater->getChild<LLComboBox>("local_size_combo")->selectNthItem(gSavedSettings.getS32("SnapshotLocalLastResolution")); |
1259 | floater->getChild<LLComboBox>("local_format_combo")->selectNthItem(gSavedSettings.getS32("SnapshotFormat")); | 1285 | floater->getChild<LLComboBox>("local_format_combo")->selectNthItem(gSavedSettings.getS32("SnapshotFormat")); |
1260 | 1286 | ||
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); | 1287 | floater->childSetVisible("upload_btn", shot_type == LLSnapshotLivePreview::SNAPSHOT_TEXTURE); |
1277 | floater->childSetVisible("send_btn", shot_type == LLSnapshotLivePreview::SNAPSHOT_POSTCARD); | 1288 | floater->childSetVisible("send_btn", shot_type == LLSnapshotLivePreview::SNAPSHOT_POSTCARD); |
1278 | floater->childSetVisible("save_btn", shot_type == LLSnapshotLivePreview::SNAPSHOT_LOCAL); | 1289 | floater->childSetVisible("save_btn", shot_type == LLSnapshotLivePreview::SNAPSHOT_LOCAL); |
1279 | floater->childSetEnabled("keep_aspect_check", shot_type != LLSnapshotLivePreview::SNAPSHOT_TEXTURE && !sAspectRatioCheckOff); | 1290 | floater->childSetEnabled("keep_aspect_check", shot_type != LLSnapshotLivePreview::SNAPSHOT_TEXTURE && !floater->impl.mAspectRatioCheckOff); |
1280 | floater->childSetEnabled("layer_types", shot_type == LLSnapshotLivePreview::SNAPSHOT_LOCAL); | 1291 | floater->childSetEnabled("layer_types", shot_type == LLSnapshotLivePreview::SNAPSHOT_LOCAL); |
1281 | if(shot_type != LLSnapshotLivePreview::SNAPSHOT_TEXTURE) | 1292 | if(shot_type != LLSnapshotLivePreview::SNAPSHOT_TEXTURE) |
1282 | { | 1293 | { |
@@ -1308,7 +1319,7 @@ void LLFloaterSnapshot::Impl::updateControls(LLFloaterSnapshot* floater) | |||
1308 | 1319 | ||
1309 | LLSnapshotLivePreview* previewp = getPreviewView(floater); | 1320 | LLSnapshotLivePreview* previewp = getPreviewView(floater); |
1310 | BOOL got_bytes = previewp && previewp->getDataSize() > 0; | 1321 | BOOL got_bytes = previewp && previewp->getDataSize() > 0; |
1311 | BOOL got_snap = previewp->getSnapshotUpToDate(); | 1322 | BOOL got_snap = previewp && previewp->getSnapshotUpToDate(); |
1312 | 1323 | ||
1313 | BOOL show_slider = | 1324 | BOOL show_slider = |
1314 | shot_type == LLSnapshotLivePreview::SNAPSHOT_POSTCARD | 1325 | shot_type == LLSnapshotLivePreview::SNAPSHOT_POSTCARD |
@@ -1321,7 +1332,10 @@ void LLFloaterSnapshot::Impl::updateControls(LLFloaterSnapshot* floater) | |||
1321 | 1332 | ||
1322 | LLLocale locale(LLLocale::USER_LOCALE); | 1333 | LLLocale locale(LLLocale::USER_LOCALE); |
1323 | std::string bytes_string; | 1334 | std::string bytes_string; |
1324 | LLResMgr::getInstance()->getIntegerString(bytes_string, (previewp->getDataSize()) >> 10 ); | 1335 | if (got_snap) |
1336 | { | ||
1337 | LLResMgr::getInstance()->getIntegerString(bytes_string, (previewp->getDataSize()) >> 10 ); | ||
1338 | } | ||
1325 | S32 upload_cost = LLGlobalEconomy::Singleton::getInstance()->getPriceUpload(); | 1339 | S32 upload_cost = LLGlobalEconomy::Singleton::getInstance()->getPriceUpload(); |
1326 | floater->childSetLabelArg("texture", "[AMOUNT]", llformat("%d",upload_cost)); | 1340 | floater->childSetLabelArg("texture", "[AMOUNT]", llformat("%d",upload_cost)); |
1327 | floater->childSetLabelArg("upload_btn", "[AMOUNT]", llformat("%d",upload_cost)); | 1341 | floater->childSetLabelArg("upload_btn", "[AMOUNT]", llformat("%d",upload_cost)); |
@@ -1652,7 +1666,7 @@ void LLFloaterSnapshot::Impl::checkAspectRatio(LLFloaterSnapshot *view, S32 inde | |||
1652 | 1666 | ||
1653 | if(0 == index) //current window size | 1667 | if(0 == index) //current window size |
1654 | { | 1668 | { |
1655 | sAspectRatioCheckOff = TRUE ; | 1669 | view->impl.mAspectRatioCheckOff = true ; |
1656 | view->childSetEnabled("keep_aspect_check", FALSE) ; | 1670 | view->childSetEnabled("keep_aspect_check", FALSE) ; |
1657 | 1671 | ||
1658 | if(previewp) | 1672 | if(previewp) |
@@ -1662,7 +1676,7 @@ void LLFloaterSnapshot::Impl::checkAspectRatio(LLFloaterSnapshot *view, S32 inde | |||
1662 | } | 1676 | } |
1663 | else if(-1 == index) //custom | 1677 | else if(-1 == index) //custom |
1664 | { | 1678 | { |
1665 | sAspectRatioCheckOff = FALSE ; | 1679 | view->impl.mAspectRatioCheckOff = false ; |
1666 | //if(LLSnapshotLivePreview::SNAPSHOT_TEXTURE != gSavedSettings.getS32("LastSnapshotType")) | 1680 | //if(LLSnapshotLivePreview::SNAPSHOT_TEXTURE != gSavedSettings.getS32("LastSnapshotType")) |
1667 | { | 1681 | { |
1668 | view->childSetEnabled("keep_aspect_check", TRUE) ; | 1682 | view->childSetEnabled("keep_aspect_check", TRUE) ; |
@@ -1675,7 +1689,7 @@ void LLFloaterSnapshot::Impl::checkAspectRatio(LLFloaterSnapshot *view, S32 inde | |||
1675 | } | 1689 | } |
1676 | else | 1690 | else |
1677 | { | 1691 | { |
1678 | sAspectRatioCheckOff = TRUE ; | 1692 | view->impl.mAspectRatioCheckOff = true ; |
1679 | view->childSetEnabled("keep_aspect_check", FALSE) ; | 1693 | view->childSetEnabled("keep_aspect_check", FALSE) ; |
1680 | 1694 | ||
1681 | if(previewp) | 1695 | if(previewp) |
@@ -1832,23 +1846,25 @@ void LLFloaterSnapshot::Impl::onCommitSnapshotFormat(LLUICtrl* ctrl, void* data) | |||
1832 | void LLFloaterSnapshot::Impl::comboSetCustom(LLFloaterSnapshot* floater, const std::string& comboname) | 1846 | void LLFloaterSnapshot::Impl::comboSetCustom(LLFloaterSnapshot* floater, const std::string& comboname) |
1833 | { | 1847 | { |
1834 | LLComboBox* combo = floater->getChild<LLComboBox>(comboname); | 1848 | LLComboBox* combo = floater->getChild<LLComboBox>(comboname); |
1849 | if (combo) | ||
1850 | { | ||
1851 | combo->setCurrentByIndex(combo->getItemCount() - 1); // "custom" is always the last index | ||
1835 | 1852 | ||
1836 | combo->setCurrentByIndex(combo->getItemCount() - 1); // "custom" is always the last index | 1853 | if(comboname == "postcard_size_combo") |
1854 | { | ||
1855 | gSavedSettings.setS32("SnapshotPostcardLastResolution", combo->getCurrentIndex()); | ||
1856 | } | ||
1857 | else if(comboname == "texture_size_combo") | ||
1858 | { | ||
1859 | gSavedSettings.setS32("SnapshotTextureLastResolution", combo->getCurrentIndex()); | ||
1860 | } | ||
1861 | else if(comboname == "local_size_combo") | ||
1862 | { | ||
1863 | gSavedSettings.setS32("SnapshotLocalLastResolution", combo->getCurrentIndex()); | ||
1864 | } | ||
1837 | 1865 | ||
1838 | if(comboname == "postcard_size_combo") | 1866 | checkAspectRatio(floater, -1); // -1 means custom |
1839 | { | ||
1840 | gSavedSettings.setS32("SnapshotPostcardLastResolution", combo->getCurrentIndex()); | ||
1841 | } | 1867 | } |
1842 | else if(comboname == "texture_size_combo") | ||
1843 | { | ||
1844 | gSavedSettings.setS32("SnapshotTextureLastResolution", combo->getCurrentIndex()); | ||
1845 | } | ||
1846 | else if(comboname == "local_size_combo") | ||
1847 | { | ||
1848 | gSavedSettings.setS32("SnapshotLocalLastResolution", combo->getCurrentIndex()); | ||
1849 | } | ||
1850 | |||
1851 | checkAspectRatio(floater, -1); // -1 means custom | ||
1852 | } | 1868 | } |
1853 | 1869 | ||
1854 | 1870 | ||
@@ -2015,6 +2031,7 @@ LLFloaterSnapshot::LLFloaterSnapshot() | |||
2015 | : LLFloater(std::string("Snapshot Floater")), | 2031 | : LLFloater(std::string("Snapshot Floater")), |
2016 | impl (*(new Impl)) | 2032 | impl (*(new Impl)) |
2017 | { | 2033 | { |
2034 | //Called from floater reg: LLUICtrlFactory::getInstance()->buildFloater(this, "floater_snapshot.xml", FALSE); | ||
2018 | } | 2035 | } |
2019 | 2036 | ||
2020 | // Destroys the object | 2037 | // Destroys the object |
@@ -2022,8 +2039,7 @@ LLFloaterSnapshot::~LLFloaterSnapshot() | |||
2022 | { | 2039 | { |
2023 | if (sInstance == this) | 2040 | if (sInstance == this) |
2024 | { | 2041 | { |
2025 | LLView::deleteViewByHandle(Impl::sPreviewHandle); | 2042 | LLView::deleteViewByHandle(impl.mPreviewHandle); |
2026 | Impl::sPreviewHandle = LLHandle<LLView>(); | ||
2027 | sInstance = NULL; | 2043 | sInstance = NULL; |
2028 | } | 2044 | } |
2029 | 2045 | ||
@@ -2092,20 +2108,27 @@ BOOL LLFloaterSnapshot::postBuild() | |||
2092 | childSetCommitCallback("texture_size_combo", Impl::onCommitResolution, this); | 2108 | childSetCommitCallback("texture_size_combo", Impl::onCommitResolution, this); |
2093 | childSetCommitCallback("local_size_combo", Impl::onCommitResolution, this); | 2109 | childSetCommitCallback("local_size_combo", Impl::onCommitResolution, this); |
2094 | 2110 | ||
2111 | gSavedSettings.setBOOL("EmeraldTemporaryUpload",FALSE); | ||
2112 | childSetValue("temp_check",FALSE); | ||
2113 | |||
2095 | // create preview window | 2114 | // create preview window |
2096 | LLRect full_screen_rect = sInstance->getRootView()->getRect(); | 2115 | LLRect full_screen_rect = getRootView()->getRect(); |
2097 | LLSnapshotLivePreview* previewp = new LLSnapshotLivePreview(full_screen_rect); | 2116 | LLSnapshotLivePreview* previewp = new LLSnapshotLivePreview(full_screen_rect); |
2098 | sInstance->getRootView()->removeChild(gSnapshotFloaterView); | 2117 | LLView* parent_view = gSnapshotFloaterView->getParent(); |
2118 | |||
2119 | parent_view->removeChild(gSnapshotFloaterView); | ||
2099 | // make sure preview is below snapshot floater | 2120 | // make sure preview is below snapshot floater |
2100 | sInstance->getRootView()->addChild(previewp); | 2121 | parent_view->addChild(previewp); |
2101 | sInstance->getRootView()->addChild(gSnapshotFloaterView); | 2122 | parent_view->addChild(gSnapshotFloaterView); |
2102 | 2123 | ||
2103 | gSavedSettings.setBOOL("EmeraldTemporaryUpload",FALSE); | 2124 | impl.mPreviewHandle = previewp->getHandle(); |
2104 | childSetValue("temp_check",FALSE); | ||
2105 | 2125 | ||
2106 | Impl::sPreviewHandle = previewp->getHandle(); | 2126 | //move snapshot floater to special purpose snapshotfloaterview |
2127 | //gFloaterView->removeChild(this); | ||
2128 | //gSnapshotFloaterView->addChild(this); | ||
2107 | 2129 | ||
2108 | impl.updateControls(this); | 2130 | impl.updateControls(this); |
2131 | impl.updateLayout(this); | ||
2109 | 2132 | ||
2110 | return TRUE; | 2133 | return TRUE; |
2111 | } | 2134 | } |
@@ -2282,6 +2305,9 @@ void LLFloaterSnapshot::hide(void*) | |||
2282 | //static | 2305 | //static |
2283 | void LLFloaterSnapshot::update() | 2306 | void LLFloaterSnapshot::update() |
2284 | { | 2307 | { |
2308 | if (!sInstance) | ||
2309 | return; | ||
2310 | |||
2285 | BOOL changed = FALSE; | 2311 | BOOL changed = FALSE; |
2286 | for (std::set<LLSnapshotLivePreview*>::iterator iter = LLSnapshotLivePreview::sList.begin(); | 2312 | for (std::set<LLSnapshotLivePreview*>::iterator iter = LLSnapshotLivePreview::sList.begin(); |
2287 | iter != LLSnapshotLivePreview::sList.end(); ++iter) | 2313 | iter != LLSnapshotLivePreview::sList.end(); ++iter) |
@@ -2311,8 +2337,10 @@ LLSnapshotFloaterView::~LLSnapshotFloaterView() | |||
2311 | 2337 | ||
2312 | BOOL LLSnapshotFloaterView::handleKey(KEY key, MASK mask, BOOL called_from_parent) | 2338 | BOOL LLSnapshotFloaterView::handleKey(KEY key, MASK mask, BOOL called_from_parent) |
2313 | { | 2339 | { |
2340 | static BOOL* sFreezeTime = rebind_llcontrol<BOOL>("FreezeTime", &gSavedSettings, true); | ||
2341 | |||
2314 | // use default handler when not in freeze-frame mode | 2342 | // use default handler when not in freeze-frame mode |
2315 | if(!gSavedSettings.getBOOL("FreezeTime")) | 2343 | if(!(*sFreezeTime)) |
2316 | { | 2344 | { |
2317 | return LLFloaterView::handleKey(key, mask, called_from_parent); | 2345 | return LLFloaterView::handleKey(key, mask, called_from_parent); |
2318 | } | 2346 | } |
@@ -2332,8 +2360,9 @@ BOOL LLSnapshotFloaterView::handleKey(KEY key, MASK mask, BOOL called_from_paren | |||
2332 | 2360 | ||
2333 | BOOL LLSnapshotFloaterView::handleMouseDown(S32 x, S32 y, MASK mask) | 2361 | BOOL LLSnapshotFloaterView::handleMouseDown(S32 x, S32 y, MASK mask) |
2334 | { | 2362 | { |
2363 | static BOOL* sFreezeTime = rebind_llcontrol<BOOL>("FreezeTime", &gSavedSettings, true); | ||
2335 | // use default handler when not in freeze-frame mode | 2364 | // use default handler when not in freeze-frame mode |
2336 | if(!gSavedSettings.getBOOL("FreezeTime")) | 2365 | if(!(*sFreezeTime)) |
2337 | { | 2366 | { |
2338 | return LLFloaterView::handleMouseDown(x, y, mask); | 2367 | return LLFloaterView::handleMouseDown(x, y, mask); |
2339 | } | 2368 | } |
@@ -2347,8 +2376,9 @@ BOOL LLSnapshotFloaterView::handleMouseDown(S32 x, S32 y, MASK mask) | |||
2347 | 2376 | ||
2348 | BOOL LLSnapshotFloaterView::handleMouseUp(S32 x, S32 y, MASK mask) | 2377 | BOOL LLSnapshotFloaterView::handleMouseUp(S32 x, S32 y, MASK mask) |
2349 | { | 2378 | { |
2379 | static BOOL* sFreezeTime = rebind_llcontrol<BOOL>("FreezeTime", &gSavedSettings, true); | ||
2350 | // use default handler when not in freeze-frame mode | 2380 | // use default handler when not in freeze-frame mode |
2351 | if(!gSavedSettings.getBOOL("FreezeTime")) | 2381 | if(!(*sFreezeTime)) |
2352 | { | 2382 | { |
2353 | return LLFloaterView::handleMouseUp(x, y, mask); | 2383 | return LLFloaterView::handleMouseUp(x, y, mask); |
2354 | } | 2384 | } |
@@ -2362,8 +2392,9 @@ BOOL LLSnapshotFloaterView::handleMouseUp(S32 x, S32 y, MASK mask) | |||
2362 | 2392 | ||
2363 | BOOL LLSnapshotFloaterView::handleHover(S32 x, S32 y, MASK mask) | 2393 | BOOL LLSnapshotFloaterView::handleHover(S32 x, S32 y, MASK mask) |
2364 | { | 2394 | { |
2395 | static BOOL* sFreezeTime = rebind_llcontrol<BOOL>("FreezeTime", &gSavedSettings, true); | ||
2365 | // use default handler when not in freeze-frame mode | 2396 | // use default handler when not in freeze-frame mode |
2366 | if(!gSavedSettings.getBOOL("FreezeTime")) | 2397 | if(!(*sFreezeTime)) |
2367 | { | 2398 | { |
2368 | return LLFloaterView::handleHover(x, y, mask); | 2399 | return LLFloaterView::handleHover(x, y, mask); |
2369 | } | 2400 | } |