From a5261a5fa8fad810ecb5c260d92c3e771822bf58 Mon Sep 17 00:00:00 2001 From: Ansariel Date: Tue, 20 Feb 2024 23:46:23 +0100 Subject: Convert BOOL to bool in llui --- indra/newview/llfloaterhoverheight.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'indra/newview/llfloaterhoverheight.cpp') diff --git a/indra/newview/llfloaterhoverheight.cpp b/indra/newview/llfloaterhoverheight.cpp index a00fc4aa84..56656d8dac 100644 --- a/indra/newview/llfloaterhoverheight.cpp +++ b/indra/newview/llfloaterhoverheight.cpp @@ -56,7 +56,7 @@ void LLFloaterHoverHeight::syncFromPreferenceSetting(void *user_data, bool updat } } -BOOL LLFloaterHoverHeight::postBuild() +bool LLFloaterHoverHeight::postBuild() { LLSliderCtrl* sldrCtrl = getChild("HoverHeightSlider"); sldrCtrl->setMinValue(MIN_HOVER_Z); @@ -86,7 +86,7 @@ BOOL LLFloaterHoverHeight::postBuild() // Set up based on initial region. onRegionChanged(); - return TRUE; + return true; } void LLFloaterHoverHeight::onClose(bool app_quitting) -- cgit v1.2.3 From 60d3dd98a44230c21803c1606552ee098ed9fa7c Mon Sep 17 00:00:00 2001 From: Ansariel Date: Wed, 21 Feb 2024 21:05:14 +0100 Subject: Convert remaining BOOL to bool --- indra/newview/llfloaterhoverheight.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/newview/llfloaterhoverheight.cpp') diff --git a/indra/newview/llfloaterhoverheight.cpp b/indra/newview/llfloaterhoverheight.cpp index 56656d8dac..7a60b4eb57 100644 --- a/indra/newview/llfloaterhoverheight.cpp +++ b/indra/newview/llfloaterhoverheight.cpp @@ -45,7 +45,7 @@ void LLFloaterHoverHeight::syncFromPreferenceSetting(void *user_data, bool updat LLFloaterHoverHeight *self = static_cast(user_data); LLSliderCtrl* sldrCtrl = self->getChild("HoverHeightSlider"); - sldrCtrl->setValue(value,FALSE); + sldrCtrl->setValue(value,false); if (isAgentAvatarValid() && update_offset) { -- cgit v1.2.3 From e2e37cced861b98de8c1a7c9c0d3a50d2d90e433 Mon Sep 17 00:00:00 2001 From: Ansariel Date: Wed, 22 May 2024 21:25:21 +0200 Subject: Fix line endlings --- indra/newview/llfloaterhoverheight.cpp | 310 ++++++++++++++++----------------- 1 file changed, 155 insertions(+), 155 deletions(-) (limited to 'indra/newview/llfloaterhoverheight.cpp') diff --git a/indra/newview/llfloaterhoverheight.cpp b/indra/newview/llfloaterhoverheight.cpp index b5cf4ad485..ef3e306da9 100644 --- a/indra/newview/llfloaterhoverheight.cpp +++ b/indra/newview/llfloaterhoverheight.cpp @@ -1,155 +1,155 @@ -/** -* @file llfloaterhoverheight.cpp -* @brief Controller for self avatar hover height -* @author vir@lindenlab.com -* -* $LicenseInfo:firstyear=2014&license=viewerlgpl$ -* Second Life Viewer Source Code -* Copyright (C) 2014, Linden Research, Inc. -* -* This library is free software; you can redistribute it and/or -* modify it under the terms of the GNU Lesser General Public -* License as published by the Free Software Foundation; -* version 2.1 of the License only. -* -* This library is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -* Lesser General Public License for more details. -* -* You should have received a copy of the GNU Lesser General Public -* License along with this library; if not, write to the Free Software -* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -* -* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA -* $/LicenseInfo$ -*/ - -#include "llviewerprecompiledheaders.h" - -#include "llfloaterhoverheight.h" -#include "llsliderctrl.h" -#include "llviewercontrol.h" -#include "llsdserialize.h" -#include "llagent.h" -#include "llviewerregion.h" -#include "llvoavatarself.h" - -LLFloaterHoverHeight::LLFloaterHoverHeight(const LLSD& key) : LLFloater(key) -{ -} - -void LLFloaterHoverHeight::syncFromPreferenceSetting(void *user_data, bool update_offset) -{ - F32 value = gSavedPerAccountSettings.getF32("AvatarHoverOffsetZ"); - - LLFloaterHoverHeight *self = static_cast(user_data); - LLSliderCtrl* sldrCtrl = self->getChild("HoverHeightSlider"); - sldrCtrl->setValue(value,false); - - if (isAgentAvatarValid() && update_offset) - { - LLVector3 offset(0.0, 0.0, llclamp(value,MIN_HOVER_Z,MAX_HOVER_Z)); - LL_INFOS("Avatar") << "setting hover from preference setting " << offset[2] << LL_ENDL; - gAgentAvatarp->setHoverOffset(offset); - //gAgentAvatarp->sendHoverHeight(); - } -} - -bool LLFloaterHoverHeight::postBuild() -{ - LLSliderCtrl* sldrCtrl = getChild("HoverHeightSlider"); - sldrCtrl->setMinValue(MIN_HOVER_Z); - sldrCtrl->setMaxValue(MAX_HOVER_Z); - sldrCtrl->setSliderMouseUpCallback(boost::bind(&LLFloaterHoverHeight::onFinalCommit,this)); - sldrCtrl->setSliderEditorCommitCallback(boost::bind(&LLFloaterHoverHeight::onFinalCommit,this)); - childSetCommitCallback("HoverHeightSlider", &LLFloaterHoverHeight::onSliderMoved, NULL); - - // Initialize slider from pref setting. - syncFromPreferenceSetting(this); - // Update slider on future pref changes. - if (gSavedPerAccountSettings.getControl("AvatarHoverOffsetZ")) - { - gSavedPerAccountSettings.getControl("AvatarHoverOffsetZ")->getCommitSignal()->connect(boost::bind(&syncFromPreferenceSetting, this, false)); - } - else - { - LL_WARNS() << "Control not found for AvatarHoverOffsetZ" << LL_ENDL; - } - - updateEditEnabled(); - - if (!mRegionChangedSlot.connected()) - { - mRegionChangedSlot = gAgent.addRegionChangedCallback(boost::bind(&LLFloaterHoverHeight::onRegionChanged,this)); - } - // Set up based on initial region. - onRegionChanged(); - - return true; -} - -void LLFloaterHoverHeight::onClose(bool app_quitting) -{ - if (mRegionChangedSlot.connected()) - { - mRegionChangedSlot.disconnect(); - } -} - -// static -void LLFloaterHoverHeight::onSliderMoved(LLUICtrl* ctrl, void* userData) -{ - if (isAgentAvatarValid()) - { - LLSliderCtrl* sldrCtrl = static_cast(ctrl); - F32 value = sldrCtrl->getValueF32(); - LLVector3 offset(0.0, 0.0, llclamp(value, MIN_HOVER_Z, MAX_HOVER_Z)); - LL_INFOS("Avatar") << "setting hover from slider moved" << offset[2] << LL_ENDL; - gAgentAvatarp->setHoverOffset(offset, false); - } -} - -// Do send-to-the-server work when slider drag completes, or new -// value entered as text. -void LLFloaterHoverHeight::onFinalCommit() -{ - LLSliderCtrl* sldrCtrl = getChild("HoverHeightSlider"); - F32 value = sldrCtrl->getValueF32(); - gSavedPerAccountSettings.setF32("AvatarHoverOffsetZ",value); -} - -void LLFloaterHoverHeight::onRegionChanged() -{ - LLViewerRegion *region = gAgent.getRegion(); - if (region && region->simulatorFeaturesReceived()) - { - updateEditEnabled(); - } - else if (region) - { - region->setSimulatorFeaturesReceivedCallback(boost::bind(&LLFloaterHoverHeight::onSimulatorFeaturesReceived,this,_1)); - } -} - -void LLFloaterHoverHeight::onSimulatorFeaturesReceived(const LLUUID ®ion_id) -{ - LLViewerRegion *region = gAgent.getRegion(); - if (region && (region->getRegionID()==region_id)) - { - updateEditEnabled(); - } -} - -void LLFloaterHoverHeight::updateEditEnabled() -{ - bool enabled = gAgent.getRegion() && gAgent.getRegion()->avatarHoverHeightEnabled(); - LLSliderCtrl* sldrCtrl = getChild("HoverHeightSlider"); - sldrCtrl->setEnabled(enabled); - if (enabled) - { - syncFromPreferenceSetting(this); - } -} - - +/** +* @file llfloaterhoverheight.cpp +* @brief Controller for self avatar hover height +* @author vir@lindenlab.com +* +* $LicenseInfo:firstyear=2014&license=viewerlgpl$ +* Second Life Viewer Source Code +* Copyright (C) 2014, Linden Research, Inc. +* +* This library is free software; you can redistribute it and/or +* modify it under the terms of the GNU Lesser General Public +* License as published by the Free Software Foundation; +* version 2.1 of the License only. +* +* This library is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +* Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser General Public +* License along with this library; if not, write to the Free Software +* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +* +* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA +* $/LicenseInfo$ +*/ + +#include "llviewerprecompiledheaders.h" + +#include "llfloaterhoverheight.h" +#include "llsliderctrl.h" +#include "llviewercontrol.h" +#include "llsdserialize.h" +#include "llagent.h" +#include "llviewerregion.h" +#include "llvoavatarself.h" + +LLFloaterHoverHeight::LLFloaterHoverHeight(const LLSD& key) : LLFloater(key) +{ +} + +void LLFloaterHoverHeight::syncFromPreferenceSetting(void *user_data, bool update_offset) +{ + F32 value = gSavedPerAccountSettings.getF32("AvatarHoverOffsetZ"); + + LLFloaterHoverHeight *self = static_cast(user_data); + LLSliderCtrl* sldrCtrl = self->getChild("HoverHeightSlider"); + sldrCtrl->setValue(value,false); + + if (isAgentAvatarValid() && update_offset) + { + LLVector3 offset(0.0, 0.0, llclamp(value,MIN_HOVER_Z,MAX_HOVER_Z)); + LL_INFOS("Avatar") << "setting hover from preference setting " << offset[2] << LL_ENDL; + gAgentAvatarp->setHoverOffset(offset); + //gAgentAvatarp->sendHoverHeight(); + } +} + +bool LLFloaterHoverHeight::postBuild() +{ + LLSliderCtrl* sldrCtrl = getChild("HoverHeightSlider"); + sldrCtrl->setMinValue(MIN_HOVER_Z); + sldrCtrl->setMaxValue(MAX_HOVER_Z); + sldrCtrl->setSliderMouseUpCallback(boost::bind(&LLFloaterHoverHeight::onFinalCommit,this)); + sldrCtrl->setSliderEditorCommitCallback(boost::bind(&LLFloaterHoverHeight::onFinalCommit,this)); + childSetCommitCallback("HoverHeightSlider", &LLFloaterHoverHeight::onSliderMoved, NULL); + + // Initialize slider from pref setting. + syncFromPreferenceSetting(this); + // Update slider on future pref changes. + if (gSavedPerAccountSettings.getControl("AvatarHoverOffsetZ")) + { + gSavedPerAccountSettings.getControl("AvatarHoverOffsetZ")->getCommitSignal()->connect(boost::bind(&syncFromPreferenceSetting, this, false)); + } + else + { + LL_WARNS() << "Control not found for AvatarHoverOffsetZ" << LL_ENDL; + } + + updateEditEnabled(); + + if (!mRegionChangedSlot.connected()) + { + mRegionChangedSlot = gAgent.addRegionChangedCallback(boost::bind(&LLFloaterHoverHeight::onRegionChanged,this)); + } + // Set up based on initial region. + onRegionChanged(); + + return true; +} + +void LLFloaterHoverHeight::onClose(bool app_quitting) +{ + if (mRegionChangedSlot.connected()) + { + mRegionChangedSlot.disconnect(); + } +} + +// static +void LLFloaterHoverHeight::onSliderMoved(LLUICtrl* ctrl, void* userData) +{ + if (isAgentAvatarValid()) + { + LLSliderCtrl* sldrCtrl = static_cast(ctrl); + F32 value = sldrCtrl->getValueF32(); + LLVector3 offset(0.0, 0.0, llclamp(value, MIN_HOVER_Z, MAX_HOVER_Z)); + LL_INFOS("Avatar") << "setting hover from slider moved" << offset[2] << LL_ENDL; + gAgentAvatarp->setHoverOffset(offset, false); + } +} + +// Do send-to-the-server work when slider drag completes, or new +// value entered as text. +void LLFloaterHoverHeight::onFinalCommit() +{ + LLSliderCtrl* sldrCtrl = getChild("HoverHeightSlider"); + F32 value = sldrCtrl->getValueF32(); + gSavedPerAccountSettings.setF32("AvatarHoverOffsetZ",value); +} + +void LLFloaterHoverHeight::onRegionChanged() +{ + LLViewerRegion *region = gAgent.getRegion(); + if (region && region->simulatorFeaturesReceived()) + { + updateEditEnabled(); + } + else if (region) + { + region->setSimulatorFeaturesReceivedCallback(boost::bind(&LLFloaterHoverHeight::onSimulatorFeaturesReceived,this,_1)); + } +} + +void LLFloaterHoverHeight::onSimulatorFeaturesReceived(const LLUUID ®ion_id) +{ + LLViewerRegion *region = gAgent.getRegion(); + if (region && (region->getRegionID()==region_id)) + { + updateEditEnabled(); + } +} + +void LLFloaterHoverHeight::updateEditEnabled() +{ + bool enabled = gAgent.getRegion() && gAgent.getRegion()->avatarHoverHeightEnabled(); + LLSliderCtrl* sldrCtrl = getChild("HoverHeightSlider"); + sldrCtrl->setEnabled(enabled); + if (enabled) + { + syncFromPreferenceSetting(this); + } +} + + -- cgit v1.2.3