- 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
meow-7.2.2
Kitty Barnett 2010-09-11 08:33:11 +02:00
parent c273067cee
commit 76969a99e9
4 changed files with 32 additions and 2 deletions

View File

@ -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);
}

View File

@ -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

View File

@ -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();
}
// ============================================================================

View File

@ -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