summaryrefslogtreecommitdiff
path: root/indra/newview/llpaneleditwearable.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview/llpaneleditwearable.cpp')
-rw-r--r--indra/newview/llpaneleditwearable.cpp50
1 files changed, 50 insertions, 0 deletions
diff --git a/indra/newview/llpaneleditwearable.cpp b/indra/newview/llpaneleditwearable.cpp
index ae54909945..5c85ea849e 100644
--- a/indra/newview/llpaneleditwearable.cpp
+++ b/indra/newview/llpaneleditwearable.cpp
@@ -382,6 +382,31 @@ LLEditWearableDictionary::PickerControlEntry::PickerControlEntry(ETextureIndex t
{
}
+/**
+ * Class to prevent hack in LLButton's constructor and use paddings declared in xml.
+ */
+class LLLabledBackButton : public LLButton
+{
+public:
+ struct Params : public LLInitParam::Block<Params, LLButton::Params>
+ {
+ Params() {}
+ };
+protected:
+ friend class LLUICtrlFactory;
+ LLLabledBackButton(const Params&);
+};
+
+static LLDefaultChildRegistry::Register<LLLabledBackButton> labeled_back_btn("labeled_back_button");
+
+LLLabledBackButton::LLLabledBackButton(const Params& params)
+: LLButton(params)
+{
+ // override hack in LLButton's constructor to use paddings have been set in xml
+ setLeftHPad(params.pad_left);
+ setRightHPad(params.pad_right);
+}
+
// Helper functions.
static const texture_vec_t null_texture_vec;
@@ -649,6 +674,8 @@ BOOL LLPanelEditWearable::postBuild()
mBtnRevert->setClickedCallback(boost::bind(&LLPanelEditWearable::onRevertButtonClicked, this));
mBtnBack = getChild<LLButton>("back_btn");
+ mBackBtnLabel = mBtnBack->getLabelUnselected();
+ mBtnBack->setLabel(LLStringUtil::null);
// handled at appearance panel level?
//mBtnBack->setClickedCallback(boost::bind(&LLPanelEditWearable::onBackButtonClicked, this));
@@ -1016,6 +1043,7 @@ void LLPanelEditWearable::showWearable(LLWearable* wearable, BOOL show)
if (show)
{
mPanelTitle->setText(title);
+ mPanelTitle->setToolTip(title);
mDescTitle->setText(description_title);
// set name
@@ -1357,6 +1385,28 @@ void LLPanelEditWearable::updateVerbs()
gSavedSettings.setU32("AvatarSex", (gAgentAvatarp->getSex() == SEX_MALE) );
}
+ // update back button and title according to dirty state.
+ static BOOL was_dirty = FALSE;
+ if (was_dirty != is_dirty) // to avoid redundant changes because this method is called from draw
+ {
+ static S32 label_width = mBtnBack->getFont()->getWidth(mBackBtnLabel);
+ const std::string& label = is_dirty ? mBackBtnLabel : LLStringUtil::null;
+ const S32 delta_width = is_dirty ? label_width : -label_width;
+
+ mBtnBack->setLabel(label);
+
+ // update rect according to label width
+ LLRect rect = mBtnBack->getRect();
+ rect.mRight += delta_width;
+ mBtnBack->setShape(rect);
+
+ // update title rect according to back button width
+ rect = mPanelTitle->getRect();
+ rect.mLeft += delta_width;
+ mPanelTitle->setShape(rect);
+
+ was_dirty = is_dirty;
+ }
}
void LLPanelEditWearable::configureAlphaCheckbox(LLVOAvatarDefines::ETextureIndex te, const std::string& name)