From 84ff583717e6c55e5eb5d33ef19795adbf201521 Mon Sep 17 00:00:00 2001 From: Vadim ProductEngine Date: Mon, 7 Nov 2011 19:47:11 +0200 Subject: STORM-1690 FIXED Constrain Proportions option was broken. By the way: - Fixed a crash in the postcard floater (accessing destroyed buttons). - Minor code cleanups. --- indra/newview/llfloatersnapshot.cpp | 63 ++++++++++++------------------ indra/newview/llpanelsnapshot.cpp | 44 +++++++++++++++++++++ indra/newview/llpanelsnapshot.h | 6 +++ indra/newview/llpanelsnapshotinventory.cpp | 42 +++----------------- indra/newview/llpanelsnapshotlocal.cpp | 45 --------------------- indra/newview/llpanelsnapshotpostcard.cpp | 50 ++---------------------- indra/newview/llpanelsnapshotprofile.cpp | 48 ----------------------- 7 files changed, 84 insertions(+), 214 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/llfloatersnapshot.cpp b/indra/newview/llfloatersnapshot.cpp index 4091b2e7bb..48e6cca623 100644 --- a/indra/newview/llfloatersnapshot.cpp +++ b/indra/newview/llfloatersnapshot.cpp @@ -1105,12 +1105,12 @@ public: static LLSpinCtrl* getWidthSpinner(LLFloaterSnapshot* floater); static LLSpinCtrl* getHeightSpinner(LLFloaterSnapshot* floater); static void enableAspectRatioCheckbox(LLFloaterSnapshot* floater, BOOL enable); + static void setAspectRatioCheckboxValue(LLFloaterSnapshot* floater, BOOL checked); static LLSnapshotLivePreview* getPreviewView(LLFloaterSnapshot *floater); static void setResolution(LLFloaterSnapshot* floater, const std::string& comboname); static void updateControls(LLFloaterSnapshot* floater); static void updateLayout(LLFloaterSnapshot* floater); - static void updateResolutionTextEntry(LLFloaterSnapshot* floater); static void setStatus(EStatus status, bool ok = true, const std::string& msg = LLStringUtil::null); EStatus getStatus() const { return mStatus; } @@ -1204,6 +1204,16 @@ void LLFloaterSnapshot::Impl::enableAspectRatioCheckbox(LLFloaterSnapshot* float } } +// static +void LLFloaterSnapshot::Impl::setAspectRatioCheckboxValue(LLFloaterSnapshot* floater, BOOL checked) +{ + LLPanelSnapshot* active_panel = getActivePanel(floater); + if (active_panel) + { + active_panel->getChild(active_panel->getAspectRatioCBName())->setValue(checked); + } +} + // static LLSnapshotLivePreview* LLFloaterSnapshot::Impl::getPreviewView(LLFloaterSnapshot *floater) { @@ -1361,7 +1371,8 @@ void LLFloaterSnapshot::Impl::updateControls(LLFloaterSnapshot* floater) floater->getChild("local_format_combo")->selectNthItem(gSavedSettings.getS32("SnapshotFormat")); // *TODO: Separate settings for Web images from postcards - enableAspectRatioCheckbox(floater, shot_type != LLSnapshotLivePreview::SNAPSHOT_TEXTURE && !floater->impl.mAspectRatioCheckOff); + enableAspectRatioCheckbox(floater, !floater->impl.mAspectRatioCheckOff); + setAspectRatioCheckboxValue(floater, gSavedSettings.getBOOL("KeepAspectForSnapshot")); floater->getChildView("layer_types")->setEnabled(shot_type == LLSnapshotLivePreview::SNAPSHOT_LOCAL); LLPanelSnapshot* active_panel = getActivePanel(floater); @@ -1463,8 +1474,6 @@ void LLFloaterSnapshot::Impl::updateControls(LLFloaterSnapshot* floater) break; } - updateResolutionTextEntry(floater); - if (previewp) { lldebugs << "Setting snapshot type (" << shot_type << "), format (" << shot_format << ")" << llendl; @@ -1482,24 +1491,6 @@ void LLFloaterSnapshot::Impl::updateControls(LLFloaterSnapshot* floater) } } -// static -void LLFloaterSnapshot::Impl::updateResolutionTextEntry(LLFloaterSnapshot* floater) -{ - LLSpinCtrl* width_spinner = getWidthSpinner(floater); - LLSpinCtrl* height_spinner = getHeightSpinner(floater); - - if(getActiveSnapshotType(floater) == LLSnapshotLivePreview::SNAPSHOT_TEXTURE) - { - width_spinner->setAllowEdit(FALSE); - height_spinner->setAllowEdit(FALSE); - } - else - { - width_spinner->setAllowEdit(TRUE); - height_spinner->setAllowEdit(TRUE); - } -} - // static void LLFloaterSnapshot::Impl::setStatus(EStatus status, bool ok, const std::string& msg) { @@ -1685,16 +1676,11 @@ void LLFloaterSnapshot::Impl::checkAspectRatio(LLFloaterSnapshot *view, S32 inde else if(-1 == index) //custom { view->impl.mAspectRatioCheckOff = false ; -#if 0 - //if(LLSnapshotLivePreview::SNAPSHOT_TEXTURE != gSavedSettings.getS32("LastSnapshotType")) -#endif - { - enableAspectRatioCheckbox(view, TRUE); + enableAspectRatioCheckbox(view, TRUE); - if(previewp) - { - previewp->mKeepAspectRatio = gSavedSettings.getBOOL("KeepAspectForSnapshot") ; - } + if(previewp) + { + previewp->mKeepAspectRatio = gSavedSettings.getBOOL("KeepAspectForSnapshot") ; } } else @@ -1816,23 +1802,24 @@ void LLFloaterSnapshot::Impl::updateResolution(LLUICtrl* ctrl, void* data, BOOL { // load last custom value #if 1 + S32 new_width = 0, new_height = 0; LLPanelSnapshot* spanel = getActivePanel(view); if (spanel) { lldebugs << "Loading typed res from panel " << spanel->getName() << llendl; - width = spanel->getTypedPreviewWidth(); - height = spanel->getTypedPreviewWidth(); + new_width = spanel->getTypedPreviewWidth(); + new_height = spanel->getTypedPreviewHeight(); } else { const S32 shot_type = getActiveSnapshotType(view); lldebugs << "Loading saved res for shot_type " << shot_type << llendl; - width = gSavedSettings.getS32(lastSnapshotWidthName(shot_type)); - height = gSavedSettings.getS32(lastSnapshotHeightName(shot_type)); + new_width = gSavedSettings.getS32(lastSnapshotWidthName(shot_type)); + new_height = gSavedSettings.getS32(lastSnapshotHeightName(shot_type)); } - llassert(width > 0 && height > 0); - previewp->setSize(width, height); + llassert(new_width > 0 && new_height > 0); + previewp->setSize(new_width, new_height); #else LLPanelSnapshot* spanel = getActivePanel(view); if (spanel) @@ -2204,7 +2191,7 @@ BOOL LLFloaterSnapshot::postBuild() #if 0 childSetCommitCallback("keep_aspect_check", Impl::onClickKeepAspectCheck, this); #endif - impl.enableAspectRatioCheckbox(this, gSavedSettings.getBOOL("KeepAspectForSnapshot")); + impl.setAspectRatioCheckboxValue(this, gSavedSettings.getBOOL("KeepAspectForSnapshot")); childSetCommitCallback("layer_types", Impl::onCommitLayerTypes, this); getChild("layer_types")->setValue("colors"); diff --git a/indra/newview/llpanelsnapshot.cpp b/indra/newview/llpanelsnapshot.cpp index d00089b181..fdae521ac5 100644 --- a/indra/newview/llpanelsnapshot.cpp +++ b/indra/newview/llpanelsnapshot.cpp @@ -28,6 +28,7 @@ #include "llpanelsnapshot.h" // libs +#include "llcombobox.h" #include "llsliderctrl.h" #include "llspinctrl.h" #include "lltrans.h" @@ -39,6 +40,11 @@ // virtual BOOL LLPanelSnapshot::postBuild() { + getChild(getImageSizeComboName())->setCommitCallback(boost::bind(&LLPanelSnapshot::onResolutionComboCommit, this, _1)); + getChild(getWidthSpinnerName())->setCommitCallback(boost::bind(&LLPanelSnapshot::onCustomResolutionCommit, this)); + getChild(getHeightSpinnerName())->setCommitCallback(boost::bind(&LLPanelSnapshot::onCustomResolutionCommit, this)); + getChild(getAspectRatioCBName())->setCommitCallback(boost::bind(&LLPanelSnapshot::onKeepAspectRatioCommit, this, _1)); + updateControls(LLSD()); return TRUE; } @@ -59,6 +65,8 @@ void LLPanelSnapshot::onOpen(const LLSD& key) { LLFloaterSnapshot::getInstance()->notify(LLSD().with("image-format-change", true)); } + + updateCustomResControls(); } LLFloaterSnapshot::ESnapshotFormat LLPanelSnapshot::getImageFormat() const @@ -103,6 +111,20 @@ LLSideTrayPanelContainer* LLPanelSnapshot::getParentContainer() return parent; } +// virtual +void LLPanelSnapshot::updateCustomResControls() +{ + LLComboBox* combo = getChild(getImageSizeComboName()); + S32 selected_idx = combo->getFirstSelectedIndex(); + const bool enable = selected_idx == (combo->getItemCount() - 1); // Current Window or Custom selected + + getChild(getWidthSpinnerName())->setEnabled(enable); + getChild(getWidthSpinnerName())->setAllowEdit(enable); + getChild(getHeightSpinnerName())->setEnabled(enable); + getChild(getHeightSpinnerName())->setAllowEdit(enable); + enableAspectRatioCheckbox(enable); +} + void LLPanelSnapshot::updateImageQualityLevel() { LLSliderCtrl* quality_slider = getChild("image_quality_slider"); @@ -149,3 +171,25 @@ void LLPanelSnapshot::cancel() goBack(); LLFloaterSnapshot::getInstance()->notify(LLSD().with("set-ready", true)); } + +void LLPanelSnapshot::onCustomResolutionCommit() +{ + LLSD info; + info["w"] = getChild(getWidthSpinnerName())->getValue().asInteger(); + info["h"] = getChild(getHeightSpinnerName())->getValue().asInteger(); + LLFloaterSnapshot::getInstance()->notify(LLSD().with("custom-res-change", info)); +} + +void LLPanelSnapshot::onResolutionComboCommit(LLUICtrl* ctrl) +{ + updateCustomResControls(); + + LLSD info; + info["combo-res-change"]["control-name"] = ctrl->getName(); + LLFloaterSnapshot::getInstance()->notify(info); +} + +void LLPanelSnapshot::onKeepAspectRatioCommit(LLUICtrl* ctrl) +{ + LLFloaterSnapshot::getInstance()->notify(LLSD().with("keep-aspect-change", ctrl->getValue().asBoolean())); +} diff --git a/indra/newview/llpanelsnapshot.h b/indra/newview/llpanelsnapshot.h index eaa0bc42c6..a49782a3e0 100644 --- a/indra/newview/llpanelsnapshot.h +++ b/indra/newview/llpanelsnapshot.h @@ -55,9 +55,15 @@ public: protected: LLSideTrayPanelContainer* getParentContainer(); + virtual void updateCustomResControls(); void updateImageQualityLevel(); void goBack(); ///< Switch to the default (Snapshot Options) panel void cancel(); + + // common UI callbacks + void onCustomResolutionCommit(); + void onResolutionComboCommit(LLUICtrl* ctrl); + void onKeepAspectRatioCommit(LLUICtrl* ctrl); }; #endif // LL_LLPANELSNAPSHOT_H diff --git a/indra/newview/llpanelsnapshotinventory.cpp b/indra/newview/llpanelsnapshotinventory.cpp index d517d3811d..63ccbc1b02 100644 --- a/indra/newview/llpanelsnapshotinventory.cpp +++ b/indra/newview/llpanelsnapshotinventory.cpp @@ -49,17 +49,13 @@ public: /*virtual*/ void onOpen(const LLSD& key); private: - void updateCustomResControls(); ///< Show/hide custom resolution controls (spinners and checkbox) - + /*virtual*/ void updateCustomResControls(); ///< Show/hide custom resolution controls (spinners and checkbox) /*virtual*/ std::string getWidthSpinnerName() const { return "inventory_snapshot_width"; } /*virtual*/ std::string getHeightSpinnerName() const { return "inventory_snapshot_height"; } /*virtual*/ std::string getAspectRatioCBName() const { return "inventory_keep_aspect_check"; } /*virtual*/ std::string getImageSizeComboName() const { return "texture_size_combo"; } /*virtual*/ void updateControls(const LLSD& info); - void onResolutionComboCommit(LLUICtrl* ctrl); - void onCustomResolutionCommit(LLUICtrl* ctrl); - void onKeepAspectRatioCommit(LLUICtrl* ctrl); void onSend(); }; @@ -74,33 +70,29 @@ LLPanelSnapshotInventory::LLPanelSnapshotInventory() // virtual BOOL LLPanelSnapshotInventory::postBuild() { - getChild(getImageSizeComboName())->setCommitCallback(boost::bind(&LLPanelSnapshotInventory::onResolutionComboCommit, this, _1)); - getChild(getWidthSpinnerName())->setCommitCallback(boost::bind(&LLPanelSnapshotInventory::onCustomResolutionCommit, this, _1)); - getChild(getHeightSpinnerName())->setCommitCallback(boost::bind(&LLPanelSnapshotInventory::onCustomResolutionCommit, this, _1)); - getChild(getAspectRatioCBName())->setCommitCallback(boost::bind(&LLPanelSnapshotInventory::onKeepAspectRatioCommit, this, _1)); return LLPanelSnapshot::postBuild(); } // virtual void LLPanelSnapshotInventory::onOpen(const LLSD& key) { -#if 0 - getChild(getImageSizeComboName())->selectNthItem(0); // FIXME? has no effect -#endif getChild("hint_lbl")->setTextArg("[UPLOAD_COST]", llformat("%d", LLGlobalEconomy::Singleton::getInstance()->getPriceUpload())); - updateCustomResControls(); LLPanelSnapshot::onOpen(key); } +// virtual void LLPanelSnapshotInventory::updateCustomResControls() { LLComboBox* combo = getChild(getImageSizeComboName()); S32 selected_idx = combo->getFirstSelectedIndex(); - bool show = selected_idx == 0 || selected_idx == (combo->getItemCount() - 1); // Current Window or Custom selected + const bool show = selected_idx == (combo->getItemCount() - 1); // Custom selected getChild(getWidthSpinnerName())->setVisible(show); getChild(getHeightSpinnerName())->setVisible(show); getChild(getAspectRatioCBName())->setVisible(show); + + // enable controls if possible + LLPanelSnapshot::updateCustomResControls(); } // virtual @@ -110,28 +102,6 @@ void LLPanelSnapshotInventory::updateControls(const LLSD& info) getChild("save_btn")->setEnabled(have_snapshot); } -void LLPanelSnapshotInventory::onResolutionComboCommit(LLUICtrl* ctrl) -{ - updateCustomResControls(); - - LLSD info; - info["combo-res-change"]["control-name"] = ctrl->getName(); - LLFloaterSnapshot::getInstance()->notify(info); -} - -void LLPanelSnapshotInventory::onCustomResolutionCommit(LLUICtrl* ctrl) -{ - LLSD info; - info["w"] = getChild(getWidthSpinnerName())->getValue().asInteger();; - info["h"] = getChild(getHeightSpinnerName())->getValue().asInteger();; - LLFloaterSnapshot::getInstance()->notify(LLSD().with("custom-res-change", info)); -} - -void LLPanelSnapshotInventory::onKeepAspectRatioCommit(LLUICtrl* ctrl) -{ - LLFloaterSnapshot::getInstance()->notify(LLSD().with("keep-aspect-change", ctrl->getValue().asBoolean())); -} - void LLPanelSnapshotInventory::onSend() { LLFloaterSnapshot::saveTexture(); diff --git a/indra/newview/llpanelsnapshotlocal.cpp b/indra/newview/llpanelsnapshotlocal.cpp index e32c34157a..eaa27b8d41 100644 --- a/indra/newview/llpanelsnapshotlocal.cpp +++ b/indra/newview/llpanelsnapshotlocal.cpp @@ -56,12 +56,7 @@ private: /*virtual*/ LLFloaterSnapshot::ESnapshotFormat getImageFormat() const; /*virtual*/ void updateControls(const LLSD& info); - void updateCustomResControls(); ///< Show/hide custom resolution controls (spinners and checkbox) - void onFormatComboCommit(LLUICtrl* ctrl); - void onResolutionComboCommit(LLUICtrl* ctrl); - void onCustomResolutionCommit(LLUICtrl* ctrl); - void onKeepAspectRatioCommit(LLUICtrl* ctrl); void onQualitySliderCommit(LLUICtrl* ctrl); void onSend(); }; @@ -77,10 +72,6 @@ LLPanelSnapshotLocal::LLPanelSnapshotLocal() // virtual BOOL LLPanelSnapshotLocal::postBuild() { - getChild(getImageSizeComboName())->setCommitCallback(boost::bind(&LLPanelSnapshotLocal::onResolutionComboCommit, this, _1)); - getChild(getWidthSpinnerName())->setCommitCallback(boost::bind(&LLPanelSnapshotLocal::onCustomResolutionCommit, this, _1)); - getChild(getHeightSpinnerName())->setCommitCallback(boost::bind(&LLPanelSnapshotLocal::onCustomResolutionCommit, this, _1)); - getChild(getAspectRatioCBName())->setCommitCallback(boost::bind(&LLPanelSnapshotLocal::onKeepAspectRatioCommit, this, _1)); getChild("image_quality_slider")->setCommitCallback(boost::bind(&LLPanelSnapshotLocal::onQualitySliderCommit, this, _1)); getChild("local_format_combo")->setCommitCallback(boost::bind(&LLPanelSnapshotLocal::onFormatComboCommit, this, _1)); @@ -90,7 +81,6 @@ BOOL LLPanelSnapshotLocal::postBuild() // virtual void LLPanelSnapshotLocal::onOpen(const LLSD& key) { - updateCustomResControls(); LLPanelSnapshot::onOpen(key); } @@ -135,47 +125,12 @@ void LLPanelSnapshotLocal::updateControls(const LLSD& info) getChild("save_btn")->setEnabled(have_snapshot); } -void LLPanelSnapshotLocal::updateCustomResControls() -{ - LLComboBox* combo = getChild(getImageSizeComboName()); - S32 selected_idx = combo->getFirstSelectedIndex(); - bool enable = selected_idx == 0 || selected_idx == (combo->getItemCount() - 1); // Current Window or Custom selected - - getChild(getWidthSpinnerName())->setEnabled(enable); - getChild(getWidthSpinnerName())->setAllowEdit(enable); - getChild(getHeightSpinnerName())->setEnabled(enable); - getChild(getHeightSpinnerName())->setAllowEdit(enable); - getChild(getAspectRatioCBName())->setEnabled(enable); -} - void LLPanelSnapshotLocal::onFormatComboCommit(LLUICtrl* ctrl) { // will call updateControls() LLFloaterSnapshot::getInstance()->notify(LLSD().with("image-format-change", true)); } -void LLPanelSnapshotLocal::onResolutionComboCommit(LLUICtrl* ctrl) -{ - updateCustomResControls(); - - LLSD info; - info["combo-res-change"]["control-name"] = ctrl->getName(); - LLFloaterSnapshot::getInstance()->notify(info); -} - -void LLPanelSnapshotLocal::onCustomResolutionCommit(LLUICtrl* ctrl) -{ - LLSD info; - info["w"] = getChild(getWidthSpinnerName())->getValue().asInteger(); - info["h"] = getChild(getHeightSpinnerName())->getValue().asInteger(); - LLFloaterSnapshot::getInstance()->notify(LLSD().with("custom-res-change", info)); -} - -void LLPanelSnapshotLocal::onKeepAspectRatioCommit(LLUICtrl* ctrl) -{ - LLFloaterSnapshot::getInstance()->notify(LLSD().with("keep-aspect-change", ctrl->getValue().asBoolean())); -} - void LLPanelSnapshotLocal::onQualitySliderCommit(LLUICtrl* ctrl) { updateImageQualityLevel(); diff --git a/indra/newview/llpanelsnapshotpostcard.cpp b/indra/newview/llpanelsnapshotpostcard.cpp index eead96d67a..0db15deec9 100644 --- a/indra/newview/llpanelsnapshotpostcard.cpp +++ b/indra/newview/llpanelsnapshotpostcard.cpp @@ -65,15 +65,11 @@ private: /*virtual*/ LLFloaterSnapshot::ESnapshotFormat getImageFormat() const { return LLFloaterSnapshot::SNAPSHOT_FORMAT_JPEG; } /*virtual*/ void updateControls(const LLSD& info); - void updateCustomResControls(); ///< Enable/disable custom resolution controls (spinners and checkbox) bool missingSubjMsgAlertCallback(const LLSD& notification, const LLSD& response); void sendPostcard(); void onMsgFormFocusRecieved(); void onFormatComboCommit(LLUICtrl* ctrl); - void onResolutionComboCommit(LLUICtrl* ctrl); - void onCustomResolutionCommit(LLUICtrl* ctrl); - void onKeepAspectRatioCommit(LLUICtrl* ctrl); void onQualitySliderCommit(LLUICtrl* ctrl); void onTabButtonPress(S32 btn_idx); void onSend(); @@ -110,10 +106,6 @@ BOOL LLPanelSnapshotPostcard::postBuild() getChild("to_form")->setFocus(TRUE); - getChild(getImageSizeComboName())->setCommitCallback(boost::bind(&LLPanelSnapshotPostcard::onResolutionComboCommit, this, _1)); - getChild(getWidthSpinnerName())->setCommitCallback(boost::bind(&LLPanelSnapshotPostcard::onCustomResolutionCommit, this, _1)); - getChild(getHeightSpinnerName())->setCommitCallback(boost::bind(&LLPanelSnapshotPostcard::onCustomResolutionCommit, this, _1)); - getChild(getAspectRatioCBName())->setCommitCallback(boost::bind(&LLPanelSnapshotPostcard::onKeepAspectRatioCommit, this, _1)); getChild("image_quality_slider")->setCommitCallback(boost::bind(&LLPanelSnapshotPostcard::onQualitySliderCommit, this, _1)); getChild("message_btn")->setToggleState(TRUE); @@ -124,7 +116,6 @@ BOOL LLPanelSnapshotPostcard::postBuild() // virtual void LLPanelSnapshotPostcard::onOpen(const LLSD& key) { - updateCustomResControls(); LLPanelSnapshot::onOpen(key); } @@ -158,19 +149,6 @@ void LLPanelSnapshotPostcard::updateControls(const LLSD& info) getChild("send_btn")->setEnabled(have_snapshot); } -void LLPanelSnapshotPostcard::updateCustomResControls() -{ - LLComboBox* combo = getChild(getImageSizeComboName()); - S32 selected_idx = combo->getFirstSelectedIndex(); - bool enable = selected_idx == 0 || selected_idx == (combo->getItemCount() - 1); // Current Window or Custom selected - - getChild(getWidthSpinnerName())->setEnabled(enable); - getChild(getWidthSpinnerName())->setAllowEdit(enable); - getChild(getHeightSpinnerName())->setEnabled(enable); - getChild(getHeightSpinnerName())->setAllowEdit(enable); - getChild(getAspectRatioCBName())->setEnabled(enable); -} - bool LLPanelSnapshotPostcard::missingSubjMsgAlertCallback(const LLSD& notification, const LLSD& response) { S32 option = LLNotificationsUtil::getSelectedOption(notification, response); @@ -233,28 +211,6 @@ void LLPanelSnapshotPostcard::onFormatComboCommit(LLUICtrl* ctrl) LLFloaterSnapshot::getInstance()->notify(LLSD().with("image-format-change", true)); } -void LLPanelSnapshotPostcard::onResolutionComboCommit(LLUICtrl* ctrl) -{ - updateCustomResControls(); - - LLSD info; - info["combo-res-change"]["control-name"] = ctrl->getName(); - LLFloaterSnapshot::getInstance()->notify(info); -} - -void LLPanelSnapshotPostcard::onCustomResolutionCommit(LLUICtrl* ctrl) -{ - LLSD info; - info["w"] = getChild(getWidthSpinnerName())->getValue().asInteger(); - info["h"] = getChild(getHeightSpinnerName())->getValue().asInteger(); - LLFloaterSnapshot::getInstance()->notify(LLSD().with("custom-res-change", info)); -} - -void LLPanelSnapshotPostcard::onKeepAspectRatioCommit(LLUICtrl* ctrl) -{ - LLFloaterSnapshot::getInstance()->notify(LLSD().with("keep-aspect-change", ctrl->getValue().asBoolean())); -} - void LLPanelSnapshotPostcard::onQualitySliderCommit(LLUICtrl* ctrl) { updateImageQualityLevel(); @@ -268,14 +224,14 @@ void LLPanelSnapshotPostcard::onQualitySliderCommit(LLUICtrl* ctrl) void LLPanelSnapshotPostcard::onTabButtonPress(S32 btn_idx) { - static LLButton* sButtons[2] = { + LLButton* buttons[2] = { getChild("message_btn"), getChild("settings_btn"), }; // Switch between Message and Settings tabs. - LLButton* clicked_btn = sButtons[btn_idx]; - LLButton* other_btn = sButtons[!btn_idx]; + LLButton* clicked_btn = buttons[btn_idx]; + LLButton* other_btn = buttons[!btn_idx]; LLSideTrayPanelContainer* container = getChild("postcard_panel_container"); diff --git a/indra/newview/llpanelsnapshotprofile.cpp b/indra/newview/llpanelsnapshotprofile.cpp index e633049af8..89245fc804 100644 --- a/indra/newview/llpanelsnapshotprofile.cpp +++ b/indra/newview/llpanelsnapshotprofile.cpp @@ -60,12 +60,7 @@ private: /*virtual*/ LLFloaterSnapshot::ESnapshotFormat getImageFormat() const { return LLFloaterSnapshot::SNAPSHOT_FORMAT_PNG; } /*virtual*/ void updateControls(const LLSD& info); - void updateCustomResControls(); ///< Enable/disable custom resolution controls (spinners and checkbox) - void onSend(); - void onResolutionComboCommit(LLUICtrl* ctrl); - void onCustomResolutionCommit(LLUICtrl* ctrl); - void onKeepAspectRatioCommit(LLUICtrl* ctrl); }; static LLRegisterPanelClassWrapper panel_class("llpanelsnapshotprofile"); @@ -79,18 +74,12 @@ LLPanelSnapshotProfile::LLPanelSnapshotProfile() // virtual BOOL LLPanelSnapshotProfile::postBuild() { - getChild(getImageSizeComboName())->setCommitCallback(boost::bind(&LLPanelSnapshotProfile::onResolutionComboCommit, this, _1)); - getChild(getWidthSpinnerName())->setCommitCallback(boost::bind(&LLPanelSnapshotProfile::onCustomResolutionCommit, this, _1)); - getChild(getHeightSpinnerName())->setCommitCallback(boost::bind(&LLPanelSnapshotProfile::onCustomResolutionCommit, this, _1)); - getChild(getAspectRatioCBName())->setCommitCallback(boost::bind(&LLPanelSnapshotProfile::onKeepAspectRatioCommit, this, _1)); - return LLPanelSnapshot::postBuild(); } // virtual void LLPanelSnapshotProfile::onOpen(const LLSD& key) { - updateCustomResControls(); LLPanelSnapshot::onOpen(key); } @@ -101,19 +90,6 @@ void LLPanelSnapshotProfile::updateControls(const LLSD& info) getChild("post_btn")->setEnabled(have_snapshot); } -void LLPanelSnapshotProfile::updateCustomResControls() ///< Enable/disable custom resolution controls (spinners and checkbox) -{ - LLComboBox* combo = getChild(getImageSizeComboName()); - S32 selected_idx = combo->getFirstSelectedIndex(); - bool enable = selected_idx == 0 || selected_idx == (combo->getItemCount() - 1); // Current Window or Custom selected - - getChild(getWidthSpinnerName())->setEnabled(enable); - getChild(getWidthSpinnerName())->setAllowEdit(enable); - getChild(getHeightSpinnerName())->setEnabled(enable); - getChild(getHeightSpinnerName())->setAllowEdit(enable); - getChild(getAspectRatioCBName())->setEnabled(enable); -} - void LLPanelSnapshotProfile::onSend() { std::string caption = getChild("caption")->getValue().asString(); @@ -122,27 +98,3 @@ void LLPanelSnapshotProfile::onSend() LLWebProfile::uploadImage(LLFloaterSnapshot::getImageData(), caption, add_location); LLFloaterSnapshot::postSave(); } - -void LLPanelSnapshotProfile::onResolutionComboCommit(LLUICtrl* ctrl) -{ - updateCustomResControls(); - - LLSD info; - info["combo-res-change"]["control-name"] = ctrl->getName(); - LLFloaterSnapshot::getInstance()->notify(info); -} - -void LLPanelSnapshotProfile::onCustomResolutionCommit(LLUICtrl* ctrl) -{ - S32 w = getChild(getWidthSpinnerName())->getValue().asInteger(); - S32 h = getChild(getHeightSpinnerName())->getValue().asInteger(); - LLSD info; - info["w"] = w; - info["h"] = h; - LLFloaterSnapshot::getInstance()->notify(LLSD().with("custom-res-change", info)); -} - -void LLPanelSnapshotProfile::onKeepAspectRatioCommit(LLUICtrl* ctrl) -{ - LLFloaterSnapshot::getInstance()->notify(LLSD().with("keep-aspect-change", ctrl->getValue().asBoolean())); -} -- cgit v1.2.3