diff options
author | William Todd Stinson <stinson@lindenlab.com> | 2012-08-30 17:52:31 -0700 |
---|---|---|
committer | William Todd Stinson <stinson@lindenlab.com> | 2012-08-30 17:52:31 -0700 |
commit | f28b993f5ea98f753da410c659e0635c50efb7b1 (patch) | |
tree | 7d47ac09e84f8fb1b93d629e5b7f85c14c3a555f | |
parent | 3e6e976d6b756c81ccadf6ccda89c2fc5a90666b (diff) |
Enabling toggle of the Put button based on the in-world object selection.
-rw-r--r-- | indra/newview/llfloaterstinson.cpp | 24 | ||||
-rw-r--r-- | indra/newview/llfloaterstinson.h | 2 |
2 files changed, 25 insertions, 1 deletions
diff --git a/indra/newview/llfloaterstinson.cpp b/indra/newview/llfloaterstinson.cpp index 697f110821..ff8fc18112 100644 --- a/indra/newview/llfloaterstinson.cpp +++ b/indra/newview/llfloaterstinson.cpp @@ -138,11 +138,21 @@ void LLFloaterStinson::onOpen(const LLSD& pKey) mTeleportFailedConnection = LLViewerParcelMgr::getInstance()->setTeleportFailedCallback(boost::bind(&LLFloaterStinson::onRegionCross, this)); } + if (!mSelectionUpdateConnection.connected()) + { + mSelectionUpdateConnection = LLSelectMgr::getInstance()->mUpdateSignal.connect(boost::bind(&LLFloaterStinson::onInWorldSelectionChange, this)); + } + checkRegionMaterialStatus(); } void LLFloaterStinson::onClose(bool pIsAppQuitting) { + if (mSelectionUpdateConnection.connected()) + { + mSelectionUpdateConnection.disconnect(); + } + if (mTeleportFailedConnection.connected()) { mTeleportFailedConnection.disconnect(); @@ -165,7 +175,8 @@ LLFloaterStinson::LLFloaterStinson(const LLSD& pParams) mWarningColor(), mErrorColor(), mRegionCrossConnection(), - mTeleportFailedConnection() + mTeleportFailedConnection(), + mSelectionUpdateConnection() { } @@ -188,6 +199,11 @@ void LLFloaterStinson::onRegionCross() checkRegionMaterialStatus(); } +void LLFloaterStinson::onInWorldSelectionChange() +{ + updateControls(); +} + void LLFloaterStinson::onDeferredCheckRegionMaterialStatus(LLUUID regionId) { checkRegionMaterialStatus(regionId); @@ -487,6 +503,9 @@ void LLFloaterStinson::updateStatusMessage() void LLFloaterStinson::updateControls() { + LLObjectSelectionHandle selectionHandle = LLSelectMgr::getInstance()->getEditSelection(); + bool isPutEnabled = (selectionHandle->valid_begin() != selectionHandle->valid_end()); + switch (getState()) { case kNoRegion : @@ -494,14 +513,17 @@ void LLFloaterStinson::updateControls() case kRequestStarted : case kNotEnabled : mGetButton->setEnabled(FALSE); + mPutButton->setEnabled(FALSE); break; case kReady : case kRequestCompleted : case kError : mGetButton->setEnabled(TRUE); + mPutButton->setEnabled(isPutEnabled); break; default : mGetButton->setEnabled(TRUE); + mPutButton->setEnabled(isPutEnabled); llassert(0); break; } diff --git a/indra/newview/llfloaterstinson.h b/indra/newview/llfloaterstinson.h index 1aeb6bbd23..1a4c511deb 100644 --- a/indra/newview/llfloaterstinson.h +++ b/indra/newview/llfloaterstinson.h @@ -66,6 +66,7 @@ private: void onGetClicked(); void onPutClicked(); void onRegionCross(); + void onInWorldSelectionChange(); void onDeferredCheckRegionMaterialStatus(LLUUID regionId); void onDeferredRequestGetMaterials(LLUUID regionId); void onDeferredRequestPutMaterials(LLUUID regionId); @@ -99,6 +100,7 @@ private: boost::signals2::connection mRegionCrossConnection; boost::signals2::connection mTeleportFailedConnection; + boost::signals2::connection mSelectionUpdateConnection; }; |