diff options
author | Vadim ProductEngine <vsavchuk@productengine.com> | 2011-11-07 19:47:11 +0200 |
---|---|---|
committer | Vadim ProductEngine <vsavchuk@productengine.com> | 2011-11-07 19:47:11 +0200 |
commit | 84ff583717e6c55e5eb5d33ef19795adbf201521 (patch) | |
tree | a57e5784cc898e7533f3d29dd97c7a21f89d5c57 /indra/newview/llpanelsnapshot.cpp | |
parent | 7cd7875a17fdecf671b6a53fd6b78787d52d8655 (diff) |
STORM-1690 FIXED Constrain Proportions option was broken.
By the way:
- Fixed a crash in the postcard floater (accessing destroyed buttons).
- Minor code cleanups.
Diffstat (limited to 'indra/newview/llpanelsnapshot.cpp')
-rw-r--r-- | indra/newview/llpanelsnapshot.cpp | 44 |
1 files changed, 44 insertions, 0 deletions
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<LLUICtrl>(getImageSizeComboName())->setCommitCallback(boost::bind(&LLPanelSnapshot::onResolutionComboCommit, this, _1)); + getChild<LLUICtrl>(getWidthSpinnerName())->setCommitCallback(boost::bind(&LLPanelSnapshot::onCustomResolutionCommit, this)); + getChild<LLUICtrl>(getHeightSpinnerName())->setCommitCallback(boost::bind(&LLPanelSnapshot::onCustomResolutionCommit, this)); + getChild<LLUICtrl>(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<LLComboBox>(getImageSizeComboName()); + S32 selected_idx = combo->getFirstSelectedIndex(); + const bool enable = selected_idx == (combo->getItemCount() - 1); // Current Window or Custom selected + + getChild<LLUICtrl>(getWidthSpinnerName())->setEnabled(enable); + getChild<LLSpinCtrl>(getWidthSpinnerName())->setAllowEdit(enable); + getChild<LLUICtrl>(getHeightSpinnerName())->setEnabled(enable); + getChild<LLSpinCtrl>(getHeightSpinnerName())->setAllowEdit(enable); + enableAspectRatioCheckbox(enable); +} + void LLPanelSnapshot::updateImageQualityLevel() { LLSliderCtrl* quality_slider = getChild<LLSliderCtrl>("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<LLUICtrl>(getWidthSpinnerName())->getValue().asInteger(); + info["h"] = getChild<LLUICtrl>(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())); +} |