summaryrefslogtreecommitdiff
path: root/indra
diff options
context:
space:
mode:
authorVadim ProductEngine <vsavchuk@productengine.com>2011-11-07 19:47:11 +0200
committerVadim ProductEngine <vsavchuk@productengine.com>2011-11-07 19:47:11 +0200
commit84ff583717e6c55e5eb5d33ef19795adbf201521 (patch)
treea57e5784cc898e7533f3d29dd97c7a21f89d5c57 /indra
parent7cd7875a17fdecf671b6a53fd6b78787d52d8655 (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')
-rw-r--r--indra/newview/llfloatersnapshot.cpp63
-rw-r--r--indra/newview/llpanelsnapshot.cpp44
-rw-r--r--indra/newview/llpanelsnapshot.h6
-rw-r--r--indra/newview/llpanelsnapshotinventory.cpp42
-rw-r--r--indra/newview/llpanelsnapshotlocal.cpp45
-rw-r--r--indra/newview/llpanelsnapshotpostcard.cpp50
-rw-r--r--indra/newview/llpanelsnapshotprofile.cpp48
7 files changed, 84 insertions, 214 deletions
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; }
@@ -1205,6 +1205,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<LLUICtrl>(active_panel->getAspectRatioCBName())->setValue(checked);
+ }
+}
+
+// static
LLSnapshotLivePreview* LLFloaterSnapshot::Impl::getPreviewView(LLFloaterSnapshot *floater)
{
LLSnapshotLivePreview* previewp = (LLSnapshotLivePreview*)floater->impl.mPreviewHandle.get();
@@ -1361,7 +1371,8 @@ void LLFloaterSnapshot::Impl::updateControls(LLFloaterSnapshot* floater)
floater->getChild<LLComboBox>("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;
@@ -1483,24 +1492,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)
{
LLFloaterSnapshot* floater = LLFloaterSnapshot::getInstance();
@@ -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<LLUICtrl>("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<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()));
+}
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<LLUICtrl>(getImageSizeComboName())->setCommitCallback(boost::bind(&LLPanelSnapshotInventory::onResolutionComboCommit, this, _1));
- getChild<LLUICtrl>(getWidthSpinnerName())->setCommitCallback(boost::bind(&LLPanelSnapshotInventory::onCustomResolutionCommit, this, _1));
- getChild<LLUICtrl>(getHeightSpinnerName())->setCommitCallback(boost::bind(&LLPanelSnapshotInventory::onCustomResolutionCommit, this, _1));
- getChild<LLUICtrl>(getAspectRatioCBName())->setCommitCallback(boost::bind(&LLPanelSnapshotInventory::onKeepAspectRatioCommit, this, _1));
return LLPanelSnapshot::postBuild();
}
// virtual
void LLPanelSnapshotInventory::onOpen(const LLSD& key)
{
-#if 0
- getChild<LLComboBox>(getImageSizeComboName())->selectNthItem(0); // FIXME? has no effect
-#endif
getChild<LLUICtrl>("hint_lbl")->setTextArg("[UPLOAD_COST]", llformat("%d", LLGlobalEconomy::Singleton::getInstance()->getPriceUpload()));
- updateCustomResControls();
LLPanelSnapshot::onOpen(key);
}
+// virtual
void LLPanelSnapshotInventory::updateCustomResControls()
{
LLComboBox* combo = getChild<LLComboBox>(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<LLUICtrl>(getWidthSpinnerName())->setVisible(show);
getChild<LLUICtrl>(getHeightSpinnerName())->setVisible(show);
getChild<LLUICtrl>(getAspectRatioCBName())->setVisible(show);
+
+ // enable controls if possible
+ LLPanelSnapshot::updateCustomResControls();
}
// virtual
@@ -110,28 +102,6 @@ void LLPanelSnapshotInventory::updateControls(const LLSD& info)
getChild<LLUICtrl>("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<LLUICtrl>(getWidthSpinnerName())->getValue().asInteger();;
- info["h"] = getChild<LLUICtrl>(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<LLUICtrl>(getImageSizeComboName())->setCommitCallback(boost::bind(&LLPanelSnapshotLocal::onResolutionComboCommit, this, _1));
- getChild<LLUICtrl>(getWidthSpinnerName())->setCommitCallback(boost::bind(&LLPanelSnapshotLocal::onCustomResolutionCommit, this, _1));
- getChild<LLUICtrl>(getHeightSpinnerName())->setCommitCallback(boost::bind(&LLPanelSnapshotLocal::onCustomResolutionCommit, this, _1));
- getChild<LLUICtrl>(getAspectRatioCBName())->setCommitCallback(boost::bind(&LLPanelSnapshotLocal::onKeepAspectRatioCommit, this, _1));
getChild<LLUICtrl>("image_quality_slider")->setCommitCallback(boost::bind(&LLPanelSnapshotLocal::onQualitySliderCommit, this, _1));
getChild<LLUICtrl>("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<LLUICtrl>("save_btn")->setEnabled(have_snapshot);
}
-void LLPanelSnapshotLocal::updateCustomResControls()
-{
- LLComboBox* combo = getChild<LLComboBox>(getImageSizeComboName());
- S32 selected_idx = combo->getFirstSelectedIndex();
- bool enable = selected_idx == 0 || 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);
- getChild<LLUICtrl>(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<LLUICtrl>(getWidthSpinnerName())->getValue().asInteger();
- info["h"] = getChild<LLUICtrl>(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<LLUICtrl>("to_form")->setFocus(TRUE);
- getChild<LLUICtrl>(getImageSizeComboName())->setCommitCallback(boost::bind(&LLPanelSnapshotPostcard::onResolutionComboCommit, this, _1));
- getChild<LLUICtrl>(getWidthSpinnerName())->setCommitCallback(boost::bind(&LLPanelSnapshotPostcard::onCustomResolutionCommit, this, _1));
- getChild<LLUICtrl>(getHeightSpinnerName())->setCommitCallback(boost::bind(&LLPanelSnapshotPostcard::onCustomResolutionCommit, this, _1));
- getChild<LLUICtrl>(getAspectRatioCBName())->setCommitCallback(boost::bind(&LLPanelSnapshotPostcard::onKeepAspectRatioCommit, this, _1));
getChild<LLUICtrl>("image_quality_slider")->setCommitCallback(boost::bind(&LLPanelSnapshotPostcard::onQualitySliderCommit, this, _1));
getChild<LLButton>("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<LLUICtrl>("send_btn")->setEnabled(have_snapshot);
}
-void LLPanelSnapshotPostcard::updateCustomResControls()
-{
- LLComboBox* combo = getChild<LLComboBox>(getImageSizeComboName());
- S32 selected_idx = combo->getFirstSelectedIndex();
- bool enable = selected_idx == 0 || 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);
- getChild<LLUICtrl>(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<LLUICtrl>(getWidthSpinnerName())->getValue().asInteger();
- info["h"] = getChild<LLUICtrl>(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<LLButton>("message_btn"),
getChild<LLButton>("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<LLSideTrayPanelContainer>("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<LLPanelSnapshotProfile> panel_class("llpanelsnapshotprofile");
@@ -79,18 +74,12 @@ LLPanelSnapshotProfile::LLPanelSnapshotProfile()
// virtual
BOOL LLPanelSnapshotProfile::postBuild()
{
- getChild<LLUICtrl>(getImageSizeComboName())->setCommitCallback(boost::bind(&LLPanelSnapshotProfile::onResolutionComboCommit, this, _1));
- getChild<LLUICtrl>(getWidthSpinnerName())->setCommitCallback(boost::bind(&LLPanelSnapshotProfile::onCustomResolutionCommit, this, _1));
- getChild<LLUICtrl>(getHeightSpinnerName())->setCommitCallback(boost::bind(&LLPanelSnapshotProfile::onCustomResolutionCommit, this, _1));
- getChild<LLUICtrl>(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<LLUICtrl>("post_btn")->setEnabled(have_snapshot);
}
-void LLPanelSnapshotProfile::updateCustomResControls() ///< Enable/disable custom resolution controls (spinners and checkbox)
-{
- LLComboBox* combo = getChild<LLComboBox>(getImageSizeComboName());
- S32 selected_idx = combo->getFirstSelectedIndex();
- bool enable = selected_idx == 0 || 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);
- getChild<LLUICtrl>(getAspectRatioCBName())->setEnabled(enable);
-}
-
void LLPanelSnapshotProfile::onSend()
{
std::string caption = getChild<LLUICtrl>("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<LLUICtrl>(getWidthSpinnerName())->getValue().asInteger();
- S32 h = getChild<LLUICtrl>(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()));
-}