From fa03d3ee3d9bcf213754250a8180a65156bffe8d Mon Sep 17 00:00:00 2001 From: Todd Stinson Date: Fri, 13 Jan 2012 17:16:43 -0800 Subject: PATH-186: Starting to build some baseline UI functionality to support the editing of linnkset fields. --- indra/newview/llfloaterpathfindinglinksets.cpp | 125 ++++++++++++++++++++- indra/newview/llfloaterpathfindinglinksets.h | 13 +++ .../xui/en/floater_pathfinding_linksets.xml | 16 +-- 3 files changed, 144 insertions(+), 10 deletions(-) diff --git a/indra/newview/llfloaterpathfindinglinksets.cpp b/indra/newview/llfloaterpathfindinglinksets.cpp index ab2f551228..11211feb43 100644 --- a/indra/newview/llfloaterpathfindinglinksets.cpp +++ b/indra/newview/llfloaterpathfindinglinksets.cpp @@ -30,6 +30,7 @@ #include "llfloaterpathfindinglinksets.h" #include "llsd.h" #include "v3math.h" +#include "lltextvalidate.h" #include "llagent.h" #include "llfloater.h" #include "llfloaterreg.h" @@ -37,6 +38,7 @@ #include "lllineeditor.h" #include "llscrolllistctrl.h" #include "llcheckboxctrl.h" +#include "llbutton.h" #include "llresmgr.h" #include "llviewerregion.h" #include "llhttpclient.h" @@ -549,6 +551,36 @@ BOOL LLFloaterPathfindingLinksets::postBuild() llassert(mFilterByWalkable != NULL); mFilterByWalkable->setCommitCallback(boost::bind(&LLFloaterPathfindingLinksets::onApplyFiltersClicked, this)); + mEditFixed = findChild("edit_fixed_value"); + llassert(mEditFixed != NULL); + + mEditWalkable = findChild("edit_walkable_value"); + llassert(mEditWalkable != NULL); + + mEditPhantom = findChild("edit_phantom_value"); + llassert(mEditPhantom != NULL); + + mEditA = findChild("edit_a_value"); + llassert(mEditA != NULL); + mEditA->setPrevalidate(LLTextValidate::validateFloat); + + mEditB = findChild("edit_b_value"); + llassert(mEditB != NULL); + mEditB->setPrevalidate(LLTextValidate::validateFloat); + + mEditC = findChild("edit_c_value"); + llassert(mEditC != NULL); + mEditC->setPrevalidate(LLTextValidate::validateFloat); + + mEditD = findChild("edit_d_value"); + llassert(mEditD != NULL); + mEditD->setPrevalidate(LLTextValidate::validateFloat); + + mApplyEdits = findChild("apply_edit_values"); + llassert(mApplyEdits != NULL); + mApplyEdits->setCommitCallback(boost::bind(&LLFloaterPathfindingLinksets::onApplyChangesClicked, this)); + mApplyEdits->setEnabled(false); + setFetchState(kFetchInitial); return LLFloater::postBuild(); @@ -597,7 +629,14 @@ LLFloaterPathfindingLinksets::LLFloaterPathfindingLinksets(const LLSD& pSeed) mFilterByName(NULL), mFilterByDescription(NULL), mFilterByFixed(NULL), - mFilterByWalkable(NULL) + mFilterByWalkable(NULL), + mEditFixed(NULL), + mEditWalkable(NULL), + mEditA(NULL), + mEditB(NULL), + mEditC(NULL), + mEditD(NULL), + mApplyEdits(NULL) { } @@ -809,6 +848,7 @@ void LLFloaterPathfindingLinksets::onClearFiltersClicked() void LLFloaterPathfindingLinksets::onLinksetsSelectionChange() { updateLinksetsStatusMessage(); + updateEditFields(); } void LLFloaterPathfindingLinksets::onRefreshLinksetsClicked() @@ -826,6 +866,11 @@ void LLFloaterPathfindingLinksets::onSelectNoneLinksetsClicked() selectNoneLinksets(); } +void LLFloaterPathfindingLinksets::onApplyChangesClicked() +{ + applyEditFields(); +} + void LLFloaterPathfindingLinksets::applyFilters() { mPathfindingLinksets.setNameFilter(mFilterByName->getText()); @@ -996,6 +1041,83 @@ void LLFloaterPathfindingLinksets::updateLinksetsStatusMessage() mLinksetsStatus->setText((LLStringExplicit)statusText, styleParams); } +void LLFloaterPathfindingLinksets::updateEditFields() +{ + std::vector selectedItems = mLinksetsScrollList->getAllSelected(); + if (selectedItems.empty()) + { + mEditFixed->clear(); + mEditWalkable->clear(); + mEditPhantom->clear(); + mEditA->clear(); + mEditB->clear(); + mEditC->clear(); + mEditD->clear(); + + mApplyEdits->setEnabled(false); + } + else + { + LLScrollListItem *firstItem = selectedItems.front(); + + const PathfindingLinksets::PathfindingLinksetMap &linksetsMap = mPathfindingLinksets.getAllLinksets(); + PathfindingLinksets::PathfindingLinksetMap::const_iterator linksetIter = linksetsMap.find(firstItem->getUUID().asString()); + const PathfindingLinkset &linkset(linksetIter->second); + + mEditFixed->set(linkset.isFixed()); + mEditWalkable->set(linkset.isWalkable()); + mEditPhantom->set(linkset.isPhantom()); + mEditA->setValue(LLSD(linkset.getA())); + mEditB->setValue(LLSD(linkset.getB())); + mEditC->setValue(LLSD(linkset.getC())); + mEditD->setValue(LLSD(linkset.getD())); + + mApplyEdits->setEnabled(true); + } +} + +void LLFloaterPathfindingLinksets::applyEditFields() +{ + BOOL isFixedBool = mEditFixed->getValue(); + BOOL isWalkableBool = mEditWalkable->getValue(); + BOOL isPhantomBool = mEditPhantom->getValue(); + const std::string &aString = mEditA->getText(); + const std::string &bString = mEditB->getText(); + const std::string &cString = mEditC->getText(); + const std::string &dString = mEditD->getText(); + F32 aValue = (F32)atof(aString.c_str()); + F32 bValue = (F32)atof(bString.c_str()); + F32 cValue = (F32)atof(cString.c_str()); + F32 dValue = (F32)atof(dString.c_str()); + + LLSD isFixed = (bool)isFixedBool; + LLSD isWalkable = (bool)isWalkableBool; + LLSD isPhantom = (bool)isPhantomBool; + LLSD a = aValue; + LLSD b = bValue; + LLSD c = cValue; + LLSD d = dValue; + + LLSD applyData; + applyData["fixed"] = isFixed; + applyData["walkable"] = isWalkable; + applyData["phantom"] = isPhantom; + applyData["a"] = a; + applyData["b"] = b; + applyData["c"] = c; + applyData["d"] = d; + + llinfos << "Apply changes:" << llendl; + llinfos << " isFixed: " << isFixed << llendl; + llinfos << " isWalkable: " << isWalkable << llendl; + llinfos << " isPhantom: " << isPhantom << llendl; + llinfos << " a: " << a << llendl; + llinfos << " b: " << b << llendl; + llinfos << " c: " << c << llendl; + llinfos << " d: " << d << llendl; + llinfos << " applyData: " << applyData << llendl; +} + //--------------------------------------------------------------------------- // NavmeshDataGetResponder //--------------------------------------------------------------------------- @@ -1020,4 +1142,3 @@ void NavmeshDataGetResponder::error(U32 status, const std::string& reason) { mLinksetsFloater->handleNavmeshDataGetError(mNavmeshDataGetURL, reason); } - diff --git a/indra/newview/llfloaterpathfindinglinksets.h b/indra/newview/llfloaterpathfindinglinksets.h index 0129d1f055..f9d747b9fe 100644 --- a/indra/newview/llfloaterpathfindinglinksets.h +++ b/indra/newview/llfloaterpathfindinglinksets.h @@ -37,6 +37,7 @@ class LLTextBase; class LLScrollListCtrl; class LLLineEditor; class LLCheckBoxCtrl; +class LLButton; class PathfindingLinkset { @@ -193,6 +194,14 @@ private: LLLineEditor *mFilterByDescription; LLCheckBoxCtrl *mFilterByFixed; LLCheckBoxCtrl *mFilterByWalkable; + LLCheckBoxCtrl *mEditFixed; + LLCheckBoxCtrl *mEditWalkable; + LLCheckBoxCtrl *mEditPhantom; + LLLineEditor *mEditA; + LLLineEditor *mEditB; + LLLineEditor *mEditC; + LLLineEditor *mEditD; + LLButton *mApplyEdits; // Does its own instance management, so clients not allowed // to allocate or destroy. @@ -210,6 +219,7 @@ private: void onRefreshLinksetsClicked(); void onSelectAllLinksetsClicked(); void onSelectNoneLinksetsClicked(); + void onApplyChangesClicked(); void applyFilters(); void clearFilters(); @@ -219,6 +229,9 @@ private: void selectNoneLinksets(); void updateLinksetsStatusMessage(); + + void updateEditFields(); + void applyEditFields(); }; #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 f4631c865a..21711880af 100644 --- a/indra/newview/skins/default/xui/en/floater_pathfinding_linksets.xml +++ b/indra/newview/skins/default/xui/en/floater_pathfinding_linksets.xml @@ -246,14 +246,14 @@ height="19" label="Fixed" layout="topleft" - name="DisplayNavmeshOverlay" + name="edit_fixed_value" top_pad="10" width="90" /> @@ -292,7 +292,7 @@ layout="topleft" left_delta="14" max_length_bytes="10" - name="estate" + name="edit_a_value" width="45" /> @@ -379,7 +379,7 @@ height="21" label="Apply changes" layout="topleft" - name="linksets" + name="apply_edit_values" top="270" left="735" width="134"/> -- cgit v1.2.3