summaryrefslogtreecommitdiff
path: root/indra/newview/llfloaterpathfindingbasic.cpp
diff options
context:
space:
mode:
authorTodd Stinson <stinson@lindenlab.com>2012-02-15 15:26:32 -0800
committerTodd Stinson <stinson@lindenlab.com>2012-02-15 15:26:32 -0800
commita17dee79f04e21f414d59ed1d5566160dda8fa08 (patch)
treea1a199ffd3f746e265cf3b04c5e6e72ae7d0666c /indra/newview/llfloaterpathfindingbasic.cpp
parentfb96262c47d9eb022f9291637c6a9ebaec833dca (diff)
PATH-297: Basic freeze/unfreeze button switching for UI buttons. Also, adding ability to detect whether region is enabled for pathfinding.
Diffstat (limited to 'indra/newview/llfloaterpathfindingbasic.cpp')
-rw-r--r--indra/newview/llfloaterpathfindingbasic.cpp83
1 files changed, 80 insertions, 3 deletions
diff --git a/indra/newview/llfloaterpathfindingbasic.cpp b/indra/newview/llfloaterpathfindingbasic.cpp
index a875cae883..a1c333989e 100644
--- a/indra/newview/llfloaterpathfindingbasic.cpp
+++ b/indra/newview/llfloaterpathfindingbasic.cpp
@@ -30,6 +30,9 @@
#include "llsd.h"
#include "llagent.h"
+#include "lltextbase.h"
+#include "llbutton.h"
+#include "llviewerregion.h"
//---------------------------------------------------------------------------
// LLFloaterPathfindingBasic
@@ -37,15 +40,40 @@
BOOL LLFloaterPathfindingBasic::postBuild()
{
- childSetAction("enter_unfrozen_mode", boost::bind(&LLFloaterPathfindingBasic::onUnfreezeClicked, this));
- childSetAction("enter_frozen_mode", boost::bind(&LLFloaterPathfindingBasic::onFreezeClicked, this));
+ mRegionNotEnabledText = findChild<LLTextBase>("disabled_warning_label");
+ llassert(mRegionNotEnabledText != NULL);
+
+ mUnfreezeLabel = findChild<LLTextBase>("unfreeze_label");
+ llassert(mUnfreezeLabel != NULL);
+
+ mUnfreezeButton = findChild<LLButton>("enter_unfrozen_mode");
+ llassert(mUnfreezeButton != NULL);
+ mUnfreezeButton->setCommitCallback(boost::bind(&LLFloaterPathfindingBasic::onUnfreezeClicked, this));
+
+ mFreezeLabel = findChild<LLTextBase>("freeze_label");
+ llassert(mFreezeLabel != NULL);
+
+ mFreezeButton = findChild<LLButton>("enter_frozen_mode");
+ llassert(mFreezeButton != NULL);
+ mFreezeButton->setCommitCallback(boost::bind(&LLFloaterPathfindingBasic::onFreezeClicked, this));
+
+ updateOnFrozenState();
return LLFloater::postBuild();
}
+void LLFloaterPathfindingBasic::onOpen(const LLSD& key)
+{
+}
LLFloaterPathfindingBasic::LLFloaterPathfindingBasic(const LLSD& pSeed)
- : LLFloater(pSeed)
+ : LLFloater(pSeed),
+ mRegionNotEnabledText(NULL),
+ mUnfreezeLabel(NULL),
+ mUnfreezeButton(NULL),
+ mFreezeLabel(NULL),
+ mFreezeButton(NULL),
+ mIsRegionFrozenXXX(true)
{
}
@@ -53,12 +81,61 @@ LLFloaterPathfindingBasic::~LLFloaterPathfindingBasic()
{
}
+std::string LLFloaterPathfindingBasic::getCapabilityURL() const
+{
+ std::string capURL("");
+
+ LLViewerRegion *region = gAgent.getRegion();
+ if (region != NULL)
+ {
+ capURL = region->getCapability("RetrieveNavMeshSrc");
+ }
+
+ return capURL;
+}
+
+void LLFloaterPathfindingBasic::updateOnFrozenState()
+{
+ std::string capURL = getCapabilityURL();
+
+ if (capURL.empty())
+ {
+ mRegionNotEnabledText->setVisible(TRUE);
+ mUnfreezeLabel->setEnabled(FALSE);
+ mUnfreezeButton->setEnabled(FALSE);
+ mFreezeLabel->setEnabled(FALSE);
+ mFreezeButton->setEnabled(FALSE);
+ }
+ else
+ {
+ mRegionNotEnabledText->setVisible(FALSE);
+ if (mIsRegionFrozenXXX)
+ {
+ mUnfreezeLabel->setEnabled(TRUE);
+ mUnfreezeButton->setEnabled(TRUE);
+ mFreezeLabel->setEnabled(FALSE);
+ mFreezeButton->setEnabled(FALSE);
+ }
+ else
+ {
+ mUnfreezeLabel->setEnabled(FALSE);
+ mUnfreezeButton->setEnabled(FALSE);
+ mFreezeLabel->setEnabled(TRUE);
+ mFreezeButton->setEnabled(TRUE);
+ }
+ }
+}
+
void LLFloaterPathfindingBasic::onUnfreezeClicked()
{
+ mIsRegionFrozenXXX = false;
+ updateOnFrozenState();
llwarns << "functionality has not yet been implemented to set unfrozen state" << llendl;
}
void LLFloaterPathfindingBasic::onFreezeClicked()
{
+ mIsRegionFrozenXXX = true;
+ updateOnFrozenState();
llwarns << "functionality has not yet been implemented to set frozen state" << llendl;
}