summaryrefslogtreecommitdiff
path: root/indra/newview
diff options
context:
space:
mode:
authorLeslie Linden <leslie@lindenlab.com>2011-10-07 12:20:06 -0700
committerLeslie Linden <leslie@lindenlab.com>2011-10-07 12:20:06 -0700
commit3ba9bd536b036fda89d467729870cfac0c5727b8 (patch)
tree71d0b1e1f515c503422ff7899d488c7523602de4 /indra/newview
parentddcd51beac061b79268c939a4e3ed48ec87fb907 (diff)
* "search" floater now only minimized after teleport if it is visible to begin
with. * LLAgent now keeps track of whether or not the agent can build in the current parcel. * Hooked up is_enabled_function to build and speak commands.
Diffstat (limited to 'indra/newview')
-rw-r--r--indra/newview/app_settings/commands.xml4
-rwxr-xr-xindra/newview/llagent.cpp43
-rw-r--r--indra/newview/llagent.h9
3 files changed, 55 insertions, 1 deletions
diff --git a/indra/newview/app_settings/commands.xml b/indra/newview/app_settings/commands.xml
index 8ee4b7d075..a59642b2d8 100644
--- a/indra/newview/app_settings/commands.xml
+++ b/indra/newview/app_settings/commands.xml
@@ -37,6 +37,8 @@
tooltip_ref="Command_Build_Tooltip"
execute_function="Floater.ToolbarToggle"
execute_parameters="build"
+ is_enabled_function="Agent.IsActionAllowed"
+ is_enabled_parameters="build"
is_running_function="Floater.IsOpen"
is_running_parameters="build"
/>
@@ -207,6 +209,8 @@
tooltip_ref="Command_Speak_Tooltip"
execute_function="Floater.ToolbarToggle"
execute_parameters="speak"
+ is_enabled_function="Agent.IsActionAllowed"
+ is_enabled_parameters="speak"
is_running_function="Floater.IsOpen"
is_running_parameters="speak"
/>
diff --git a/indra/newview/llagent.cpp b/indra/newview/llagent.cpp
index ba42126985..ed29ac7960 100755
--- a/indra/newview/llagent.cpp
+++ b/indra/newview/llagent.cpp
@@ -71,6 +71,7 @@
#include "lltoolpie.h"
#include "lltoolmgr.h"
#include "lltrans.h"
+#include "lluictrl.h"
#include "llurlentry.h"
#include "llviewercontrol.h"
#include "llviewerdisplay.h"
@@ -152,6 +153,34 @@ bool handleSlowMotionAnimation(const LLSD& newvalue)
return true;
}
+// static
+void LLAgent::parcelChangedCallback()
+{
+ bool can_edit = LLToolMgr::getInstance()->canEdit();
+
+ gAgent.mCanEditParcel = can_edit;
+}
+
+// static
+bool LLAgent::isActionAllowed(const LLSD& sdname)
+{
+ bool retval = false;
+
+ const std::string& param = sdname.asString();
+
+ if (param == "build")
+ {
+ retval = gAgent.canEditParcel();
+ }
+ else if (param == "speak")
+ {
+ retval = true;
+ }
+
+ return retval;
+}
+
+
// ************************************************************
// Enabled this definition to compile a 'hacked' viewer that
// locally believes the end user has godlike powers.
@@ -183,6 +212,7 @@ LLAgent::LLAgent() :
mbTeleportKeepsLookAt(false),
mAgentAccess(new LLAgentAccess(gSavedSettings)),
+ mCanEditParcel(false),
mTeleportSourceSLURL(new LLSLURL),
mTeleportState( TELEPORT_NONE ),
mRegionp(NULL),
@@ -246,6 +276,10 @@ LLAgent::LLAgent() :
mListener.reset(new LLAgentListener(*this));
mMoveTimer.stop();
+
+ LLViewerParcelMgr::getInstance()->addAgentParcelChangedCallback(boost::bind(&LLAgent::parcelChangedCallback));
+
+ LLUICtrl::EnableCallbackRegistry::currentRegistrar().add("Agent.IsActionAllowed", boost::bind(&LLAgent::isActionAllowed, _2));
}
// Requires gSavedSettings to be initialized.
@@ -3361,7 +3395,14 @@ bool LLAgent::teleportCore(bool is_local)
LLFloaterReg::hideInstance("region_info");
// minimize the Search floater (STORM-1474)
- LLFloaterReg::getInstance("search")->setMinimized(TRUE);
+ {
+ LLFloater* instance = LLFloaterReg::getInstance("search");
+
+ if (instance && instance->getVisible())
+ {
+ instance->setMinimized(TRUE);
+ }
+ }
LLViewerParcelMgr::getInstance()->deselectLand();
LLViewerMediaFocus::getInstance()->clearFocus();
diff --git a/indra/newview/llagent.h b/indra/newview/llagent.h
index 5e23ced424..1775a0235c 100644
--- a/indra/newview/llagent.h
+++ b/indra/newview/llagent.h
@@ -575,6 +575,15 @@ private:
** **
*******************************************************************************/
+ // Build
+public:
+ bool canEditParcel() const { return mCanEditParcel; }
+private:
+ bool mCanEditParcel;
+
+ static bool isActionAllowed(const LLSD& sdname);
+ static void parcelChangedCallback();
+
/********************************************************************************
** **
** ACCESS