From f28b993f5ea98f753da410c659e0635c50efb7b1 Mon Sep 17 00:00:00 2001 From: William Todd Stinson Date: Thu, 30 Aug 2012 17:52:31 -0700 Subject: Enabling toggle of the Put button based on the in-world object selection. --- indra/newview/llfloaterstinson.cpp | 24 +++++++++++++++++++++++- indra/newview/llfloaterstinson.h | 2 ++ 2 files changed, 25 insertions(+), 1 deletion(-) (limited to 'indra/newview') 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; }; -- cgit v1.2.3