From 76969a99e9cc5ed3fca081383628a417f7a21c1c Mon Sep 17 00:00:00 2001 From: Kitty Barnett <develop@catznip.com> Date: Sat, 11 Sep 2010 08:33:11 +0200 Subject: [PATCH] - fixed : "Build" button on the bottom tray should visually disable when both @edit=n and @rez=n restricted (thankies Chloe) -> see http://redmine.catznip.com/issues/2 - fixed : "Build" menu option under "Build" should visually disable when both @edit=n and @rez=n restricted --HG-- branch : RLVa --- indra/newview/llbottomtray.cpp | 9 ++++++++- indra/newview/lltoolmgr.cpp | 6 +++++- indra/newview/rlvui.cpp | 17 +++++++++++++++++ indra/newview/rlvui.h | 2 ++ 4 files changed, 32 insertions(+), 2 deletions(-) diff --git a/indra/newview/llbottomtray.cpp b/indra/newview/llbottomtray.cpp index 6ee4387236..ad5447bf33 100644 --- a/indra/newview/llbottomtray.cpp +++ b/indra/newview/llbottomtray.cpp @@ -48,10 +48,17 @@ #include "llsyswellwindow.h" #include "lltoolmgr.h" #include "llviewerparcelmgr.h" +// [RLVa:KB] - Checked: 2010-09-11 (RLVa-1.2.1d) +#include "rlvhandler.h" +#include "rlvui.h" +// [/RLVa:KB] static void update_build_button_enable_state() { - bool can_edit = LLToolMgr::getInstance()->canEdit(); +// bool can_edit = LLToolMgr::getInstance()->canEdit(); +// [RLVa:KB] - Checked: 2010-09-11 (RLVa-1.2.1d) | Added: RLVa-1.2.1d + bool can_edit = RlvUIEnabler::isBuildEnabled(); +// [/RLVa:KB] LLBottomTray::getInstance()->getChildView("build_btn")->setEnabled(can_edit); } diff --git a/indra/newview/lltoolmgr.cpp b/indra/newview/lltoolmgr.cpp index 8f25ec4e9f..f9b413410d 100644 --- a/indra/newview/lltoolmgr.cpp +++ b/indra/newview/lltoolmgr.cpp @@ -57,6 +57,7 @@ #include "llviewerparcelmgr.h" // [RLVa:KB] - Checked: 2010-04-11 (RLVa-1.2.0e) #include "rlvhandler.h" +#include "rlvui.h" // [/RLVa:KB] // Used when app not active to avoid processing hover. @@ -82,7 +83,10 @@ LLToolMgr::LLToolMgr() { // Not a panel, register these callbacks globally. LLUICtrl::EnableCallbackRegistry::currentRegistrar().add("Build.Active", boost::bind(&LLToolMgr::inEdit, this)); - LLUICtrl::EnableCallbackRegistry::currentRegistrar().add("Build.Enabled", boost::bind(&LLToolMgr::canEdit, this)); +// LLUICtrl::EnableCallbackRegistry::currentRegistrar().add("Build.Enabled", boost::bind(&LLToolMgr::canEdit, this)); +// [RLVa:KB] - Checked: 2010-09-11 (RLVa-1.2.1d) | Added: RLVa-1.2.1d + LLUICtrl::EnableCallbackRegistry::currentRegistrar().add("Build.Enabled", boost::bind(&RlvUIEnabler::isBuildEnabled)); +// [/RLVa:KB] LLUICtrl::CommitCallbackRegistry::currentRegistrar().add("Build.Toggle", boost::bind(&LLToolMgr::toggleBuildMode, this)); gToolNull = new LLTool(LLStringUtil::null); // Does nothing diff --git a/indra/newview/rlvui.cpp b/indra/newview/rlvui.cpp index 6d55b076ec..59c7a660e2 100644 --- a/indra/newview/rlvui.cpp +++ b/indra/newview/rlvui.cpp @@ -65,6 +65,7 @@ RlvUIEnabler::RlvUIEnabler() // onToggleXXX m_Handlers.insert(std::pair<ERlvBehaviour, behaviour_handler_t>(RLV_BHVR_EDIT, boost::bind(&RlvUIEnabler::onToggleEdit, this))); m_Handlers.insert(std::pair<ERlvBehaviour, behaviour_handler_t>(RLV_BHVR_FLY, boost::bind(&RlvUIEnabler::onToggleFly, this))); + m_Handlers.insert(std::pair<ERlvBehaviour, behaviour_handler_t>(RLV_BHVR_REZ, boost::bind(&RlvUIEnabler::onToggleRez, this))); m_Handlers.insert(std::pair<ERlvBehaviour, behaviour_handler_t>(RLV_BHVR_SETENV, boost::bind(&RlvUIEnabler::onToggleSetEnv, this))); m_Handlers.insert(std::pair<ERlvBehaviour, behaviour_handler_t>(RLV_BHVR_SHOWINV, boost::bind(&RlvUIEnabler::onToggleShowInv, this))); m_Handlers.insert(std::pair<ERlvBehaviour, behaviour_handler_t>(RLV_BHVR_SHOWLOC, boost::bind(&RlvUIEnabler::onToggleShowLoc, this))); @@ -127,6 +128,9 @@ void RlvUIEnabler::onToggleEdit() LLToolMgr::instance().toggleBuildMode(); } + // Enable/disable the "Build" bottom tray button (but only if edit *and* rez restricted) + LLBottomTray::getInstance()->getChild<LLButton>("build_btn")->setEnabled(isBuildEnabled()); + // Start or stop filtering opening the beacons floater if (!fEnable) addGenericFloaterFilter("beacons"); @@ -147,6 +151,13 @@ void RlvUIEnabler::onToggleFly() LLFloaterMove::sUpdateFlyingStatus(); } +// Checked: 2010-09-11 (RLVa-1.2.1d) | Added: RLVa-1.2.1d +void RlvUIEnabler::onToggleRez() +{ + // Enable/disable the "Build" bottom tray button + LLBottomTray::getInstance()->getChild<LLButton>("build_btn")->setEnabled(isBuildEnabled()); +} + // Checked: 2010-03-17 (RLVa-1.2.0a) | Added: RLVa-1.2.0a void RlvUIEnabler::onToggleSetEnv() { @@ -597,4 +608,10 @@ bool RlvUIEnabler::hasOpenProfile(const LLUUID& idAgent) return false; } +// Checked: 2010-09-11 (RLVa-1.2.1d) | Added: RLVa-1.2.1d +bool RlvUIEnabler::isBuildEnabled() +{ + return (!gRlvHandler.hasBehaviour(RLV_BHVR_EDIT) || !gRlvHandler.hasBehaviour(RLV_BHVR_REZ)) && LLToolMgr::getInstance()->canEdit(); +} + // ============================================================================ diff --git a/indra/newview/rlvui.h b/indra/newview/rlvui.h index 6c6a6a40eb..8ac6ab3702 100644 --- a/indra/newview/rlvui.h +++ b/indra/newview/rlvui.h @@ -46,6 +46,7 @@ protected: void onRefreshHoverText(); // showloc, shownames, showhovertext(all|world|hud) void onToggleEdit(); // edit void onToggleFly(); // fly + void onToggleRez(); // rez void onToggleSetEnv(); // setenv void onToggleShowInv(); // showinv void onToggleShowLoc(); // showloc @@ -92,6 +93,7 @@ public: static bool canViewRegionProperties(); // showloc static bool hasOpenIM(const LLUUID& idAgent); // shownames static bool hasOpenProfile(const LLUUID& idAgent); // shownames + static bool isBuildEnabled(); // edit and rez /* * Member variables -- GitLab