From 7e213192a2b799e0b3d8590bbc5c81c80a2ee0fa Mon Sep 17 00:00:00 2001 From: Todd Stinson Date: Tue, 17 Jan 2012 17:31:46 -0800 Subject: PATH-186: Enabling and disabling the edit fields based on whether linksets are selected. --- indra/newview/llfloaterpathfindinglinksets.cpp | 44 ++++++++++++++++++++-- indra/newview/llfloaterpathfindinglinksets.h | 6 +++ .../xui/en/floater_pathfinding_linksets.xml | 10 +++++ 3 files changed, 57 insertions(+), 3 deletions(-) diff --git a/indra/newview/llfloaterpathfindinglinksets.cpp b/indra/newview/llfloaterpathfindinglinksets.cpp index 11211feb43..732427103f 100644 --- a/indra/newview/llfloaterpathfindinglinksets.cpp +++ b/indra/newview/llfloaterpathfindinglinksets.cpp @@ -560,6 +560,21 @@ BOOL LLFloaterPathfindingLinksets::postBuild() mEditPhantom = findChild("edit_phantom_value"); llassert(mEditPhantom != NULL); + mLabelWalkabilityCoefficients = findChild("walkability_coefficients_label"); + llassert(mLabelWalkabilityCoefficients != NULL); + + mLabelEditA = findChild("edit_a_label"); + llassert(mLabelEditA != NULL); + + mLabelEditB = findChild("edit_b_label"); + llassert(mLabelEditB != NULL); + + mLabelEditC = findChild("edit_c_label"); + llassert(mLabelEditC != NULL); + + mLabelEditD = findChild("edit_d_label"); + llassert(mLabelEditD != NULL); + mEditA = findChild("edit_a_value"); llassert(mEditA != NULL); mEditA->setPrevalidate(LLTextValidate::validateFloat); @@ -579,8 +594,8 @@ BOOL LLFloaterPathfindingLinksets::postBuild() mApplyEdits = findChild("apply_edit_values"); llassert(mApplyEdits != NULL); mApplyEdits->setCommitCallback(boost::bind(&LLFloaterPathfindingLinksets::onApplyChangesClicked, this)); - mApplyEdits->setEnabled(false); + setEnableEditFields(false); setFetchState(kFetchInitial); return LLFloater::postBuild(); @@ -632,6 +647,12 @@ LLFloaterPathfindingLinksets::LLFloaterPathfindingLinksets(const LLSD& pSeed) mFilterByWalkable(NULL), mEditFixed(NULL), mEditWalkable(NULL), + mEditPhantom(NULL), + mLabelWalkabilityCoefficients(NULL), + mLabelEditA(NULL), + mLabelEditB(NULL), + mLabelEditC(NULL), + mLabelEditD(NULL), mEditA(NULL), mEditB(NULL), mEditC(NULL), @@ -1054,7 +1075,7 @@ void LLFloaterPathfindingLinksets::updateEditFields() mEditC->clear(); mEditD->clear(); - mApplyEdits->setEnabled(false); + setEnableEditFields(false); } else { @@ -1072,7 +1093,7 @@ void LLFloaterPathfindingLinksets::updateEditFields() mEditC->setValue(LLSD(linkset.getC())); mEditD->setValue(LLSD(linkset.getD())); - mApplyEdits->setEnabled(true); + setEnableEditFields(true); } } @@ -1118,6 +1139,23 @@ void LLFloaterPathfindingLinksets::applyEditFields() llinfos << " applyData: " << applyData << llendl; } +void LLFloaterPathfindingLinksets::setEnableEditFields(BOOL pEnabled) +{ + mEditFixed->setEnabled(pEnabled); + mEditWalkable->setEnabled(pEnabled); + mEditPhantom->setEnabled(pEnabled); + mLabelWalkabilityCoefficients->setEnabled(pEnabled); + mLabelEditA->setEnabled(pEnabled); + mLabelEditB->setEnabled(pEnabled); + mLabelEditC->setEnabled(pEnabled); + mLabelEditD->setEnabled(pEnabled); + mEditA->setEnabled(pEnabled); + mEditB->setEnabled(pEnabled); + mEditC->setEnabled(pEnabled); + mEditD->setEnabled(pEnabled); + mApplyEdits->setEnabled(pEnabled); +} + //--------------------------------------------------------------------------- // NavmeshDataGetResponder //--------------------------------------------------------------------------- diff --git a/indra/newview/llfloaterpathfindinglinksets.h b/indra/newview/llfloaterpathfindinglinksets.h index f9d747b9fe..43f4c3819f 100644 --- a/indra/newview/llfloaterpathfindinglinksets.h +++ b/indra/newview/llfloaterpathfindinglinksets.h @@ -197,6 +197,11 @@ private: LLCheckBoxCtrl *mEditFixed; LLCheckBoxCtrl *mEditWalkable; LLCheckBoxCtrl *mEditPhantom; + LLTextBase *mLabelWalkabilityCoefficients; + LLTextBase *mLabelEditA; + LLTextBase *mLabelEditB; + LLTextBase *mLabelEditC; + LLTextBase *mLabelEditD; LLLineEditor *mEditA; LLLineEditor *mEditB; LLLineEditor *mEditC; @@ -232,6 +237,7 @@ private: void updateEditFields(); void applyEditFields(); + void setEnableEditFields(BOOL pEnabled); }; #endif // LL_LLFLOATERPATHFINDINGLINKSETS_H diff --git a/indra/newview/skins/default/xui/en/floater_pathfinding_linksets.xml b/indra/newview/skins/default/xui/en/floater_pathfinding_linksets.xml index 21711880af..53edf5294c 100644 --- a/indra/newview/skins/default/xui/en/floater_pathfinding_linksets.xml +++ b/indra/newview/skins/default/xui/en/floater_pathfinding_linksets.xml @@ -263,6 +263,8 @@ use_ellipses="false" type="string" text_color="LabelTextColor" + text_readonly_color="LabelDisabledColor" + name="walkability_coefficients_label" length="1" follows="left|top" layout="topleft" @@ -277,6 +279,8 @@ use_ellipses="false" type="string" text_color="LabelTextColor" + text_readonly_color="LabelDisabledColor" + name="edit_a_label" length="1" follows="left|top" layout="topleft" @@ -300,6 +304,8 @@ use_ellipses="false" type="string" text_color="LabelTextColor" + text_readonly_color="LabelDisabledColor" + name="edit_b_label" length="1" follows="left|top" layout="topleft" @@ -324,6 +330,8 @@ use_ellipses="false" type="string" text_color="LabelTextColor" + text_readonly_color="LabelDisabledColor" + name="edit_c_label" length="1" follows="left|top" layout="topleft" @@ -348,6 +356,8 @@ use_ellipses="false" type="string" text_color="LabelTextColor" + text_readonly_color="LabelDisabledColor" + name="edit_d_label" length="1" follows="left|top" layout="topleft" -- cgit v1.2.3