diff options
author | Nat Goodspeed <nat@lindenlab.com> | 2024-05-15 12:18:31 -0400 |
---|---|---|
committer | Nat Goodspeed <nat@lindenlab.com> | 2024-05-15 12:18:31 -0400 |
commit | 7ccf02515ad3f9e3bf795d651fe4b3c0d773f353 (patch) | |
tree | c4adc897c07f652e617e91fbf41c12b823acc808 /indra/newview/llfloaterhoverheight.cpp | |
parent | 1abf5f18d6afc7ae9e1b1562b92e5c1ce33b722f (diff) | |
parent | e7eced3c87310b15ac20cc3cd470d67686104a14 (diff) |
Merge commit 'e7eced3' into lua-timers for whitespace fixes.
Diffstat (limited to 'indra/newview/llfloaterhoverheight.cpp')
-rw-r--r-- | indra/newview/llfloaterhoverheight.cpp | 142 |
1 files changed, 71 insertions, 71 deletions
diff --git a/indra/newview/llfloaterhoverheight.cpp b/indra/newview/llfloaterhoverheight.cpp index a00fc4aa84..2d9bb61dc1 100644 --- a/indra/newview/llfloaterhoverheight.cpp +++ b/indra/newview/llfloaterhoverheight.cpp @@ -1,4 +1,4 @@ -/** +/** * @file llfloaterhoverheight.cpp * @brief Controller for self avatar hover height * @author vir@lindenlab.com @@ -41,60 +41,60 @@ 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<LLFloaterHoverHeight*>(user_data); - LLSliderCtrl* sldrCtrl = self->getChild<LLSliderCtrl>("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(); - } + F32 value = gSavedPerAccountSettings.getF32("AvatarHoverOffsetZ"); + + LLFloaterHoverHeight *self = static_cast<LLFloaterHoverHeight*>(user_data); + LLSliderCtrl* sldrCtrl = self->getChild<LLSliderCtrl>("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<LLSliderCtrl>("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; + LLSliderCtrl* sldrCtrl = getChild<LLSliderCtrl>("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(); - } + if (mRegionChangedSlot.connected()) + { + mRegionChangedSlot.disconnect(); + } } // static @@ -114,42 +114,42 @@ void LLFloaterHoverHeight::onSliderMoved(LLUICtrl* ctrl, void* userData) // value entered as text. void LLFloaterHoverHeight::onFinalCommit() { - LLSliderCtrl* sldrCtrl = getChild<LLSliderCtrl>("HoverHeightSlider"); - F32 value = sldrCtrl->getValueF32(); - gSavedPerAccountSettings.setF32("AvatarHoverOffsetZ",value); + LLSliderCtrl* sldrCtrl = getChild<LLSliderCtrl>("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)); - } + 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(); - } + LLViewerRegion *region = gAgent.getRegion(); + if (region && (region->getRegionID()==region_id)) + { + updateEditEnabled(); + } } void LLFloaterHoverHeight::updateEditEnabled() { - bool enabled = gAgent.getRegion() && gAgent.getRegion()->avatarHoverHeightEnabled(); - LLSliderCtrl* sldrCtrl = getChild<LLSliderCtrl>("HoverHeightSlider"); - sldrCtrl->setEnabled(enabled); - if (enabled) - { - syncFromPreferenceSetting(this); - } + bool enabled = gAgent.getRegion() && gAgent.getRegion()->avatarHoverHeightEnabled(); + LLSliderCtrl* sldrCtrl = getChild<LLSliderCtrl>("HoverHeightSlider"); + sldrCtrl->setEnabled(enabled); + if (enabled) + { + syncFromPreferenceSetting(this); + } } |