diff options
author | Todd Stinson <stinson@lindenlab.com> | 2012-02-15 15:26:32 -0800 |
---|---|---|
committer | Todd Stinson <stinson@lindenlab.com> | 2012-02-15 15:26:32 -0800 |
commit | a17dee79f04e21f414d59ed1d5566160dda8fa08 (patch) | |
tree | a1a199ffd3f746e265cf3b04c5e6e72ae7d0666c /indra | |
parent | fb96262c47d9eb022f9291637c6a9ebaec833dca (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')
-rw-r--r-- | indra/newview/llfloaterpathfindingbasic.cpp | 83 | ||||
-rw-r--r-- | indra/newview/llfloaterpathfindingbasic.h | 15 | ||||
-rw-r--r-- | indra/newview/skins/default/xui/en/floater_pathfinding_basic.xml | 25 |
3 files changed, 116 insertions, 7 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;
}
diff --git a/indra/newview/llfloaterpathfindingbasic.h b/indra/newview/llfloaterpathfindingbasic.h index 888d06c521..cd51964339 100644 --- a/indra/newview/llfloaterpathfindingbasic.h +++ b/indra/newview/llfloaterpathfindingbasic.h @@ -32,6 +32,8 @@ #include "llhandle.h" class LLSD; +class LLTextBase; +class LLButton; class LLFloaterPathfindingBasic : public LLFloater @@ -39,8 +41,8 @@ class LLFloaterPathfindingBasic friend class LLFloaterReg; public: - virtual BOOL postBuild(); + virtual void onOpen(const LLSD& key); protected: @@ -52,6 +54,17 @@ private: void onUnfreezeClicked(); void onFreezeClicked(); + + std::string getCapabilityURL() const; + + void updateOnFrozenState(); + + LLTextBase *mRegionNotEnabledText; + LLTextBase *mUnfreezeLabel; + LLButton *mUnfreezeButton; + LLTextBase *mFreezeLabel; + LLButton *mFreezeButton; + bool mIsRegionFrozenXXX; // XXX stinson : Feb 15, 2012 : I think this will be unneeded with the service }; #endif // LL_LLFLOATERPATHFINDINGBASIC_H diff --git a/indra/newview/skins/default/xui/en/floater_pathfinding_basic.xml b/indra/newview/skins/default/xui/en/floater_pathfinding_basic.xml index e21b6c842f..36c7f11f5d 100644 --- a/indra/newview/skins/default/xui/en/floater_pathfinding_basic.xml +++ b/indra/newview/skins/default/xui/en/floater_pathfinding_basic.xml @@ -2,7 +2,7 @@ <floater open_positioning="cascading" can_tear_off="false" - height="204" + height="213" layout="topleft" name="floater_pathfinding_basic" help_topic="floater_pathfinding_basic" @@ -13,17 +13,34 @@ width="312"> <text height="13" + word_wrap="false" + use_ellipses="false" + type="string" + text_color="DrYellow" + length="1" + follows="left|top" + layout="topleft" + left="15" + name="disabled_warning_label" + top="8" + width="289"> + This region is not enabled for pathfinding. + </text> + <text + height="13" word_wrap="true" use_ellipses="false" type="string" text_color="LabelTextColor" + text_readonly_color="LabelDisabledColor" length="1" follows="left|top" layout="topleft" left="15" - top="15" + name="unfreeze_label" + top_pad="4" width="289"> - Permit object / terrain changes: + Allow object / terrain changes: </text> <button follows="left|top" @@ -38,11 +55,13 @@ use_ellipses="false" type="string" text_color="LabelTextColor" + text_readonly_color="LabelDisabledColor" length="1" follows="left|top" layout="topleft" line_spacing.multiple="1.5" left="15" + name="freeze_label" top_pad="23" width="289"> In unfrozen mode, you can move and make changes to objects and terrain. When you are finished, click the Freeze button. It may require a few minutes to process your changes. |