diff options
author | Rider Linden <rider@lindenlab.com> | 2018-08-16 09:43:54 -0700 |
---|---|---|
committer | Rider Linden <rider@lindenlab.com> | 2018-08-16 09:43:54 -0700 |
commit | 68158f0340729d9f7e5a4b3e64bfc154a105ab6c (patch) | |
tree | 8ebde15decf4916f19c3df28f3e6dcb493b2ef6f /indra/newview/llpanelenvironment.cpp | |
parent | af2fa3c5bd669fb28af904b3ac74fb28cb22025c (diff) |
Pass call backs into parcel and region change methods.
Diffstat (limited to 'indra/newview/llpanelenvironment.cpp')
-rw-r--r-- | indra/newview/llpanelenvironment.cpp | 62 |
1 files changed, 48 insertions, 14 deletions
diff --git a/indra/newview/llpanelenvironment.cpp b/indra/newview/llpanelenvironment.cpp index a2788124e7..d323e5f43b 100644 --- a/indra/newview/llpanelenvironment.cpp +++ b/indra/newview/llpanelenvironment.cpp @@ -221,6 +221,8 @@ LLFloaterEditExtDayCycle * LLPanelEnvironmentInfo::getEditFloater() void LLPanelEnvironmentInfo::setControlsEnabled(bool enabled) { + S32 rdo_selection = getChild<LLRadioGroup>(RDG_ENVIRONMENT_SELECT)->getSelectedIndex(); + getChild<LLUICtrl>(RDG_ENVIRONMENT_SELECT)->setEnabled(enabled); getChild<LLUICtrl>(RDO_USEDEFAULT)->setEnabled(enabled); getChild<LLUICtrl>(RDO_USEINV)->setEnabled(enabled); @@ -228,8 +230,8 @@ void LLPanelEnvironmentInfo::setControlsEnabled(bool enabled) getChild<LLUICtrl>(EDT_INVNAME)->setEnabled(FALSE); getChild<LLUICtrl>(BTN_SELECTINV)->setEnabled(enabled); getChild<LLUICtrl>(BTN_EDIT)->setEnabled(enabled); - getChild<LLUICtrl>(SLD_DAYLENGTH)->setEnabled(enabled); - getChild<LLUICtrl>(SLD_DAYOFFSET)->setEnabled(enabled); + getChild<LLUICtrl>(SLD_DAYLENGTH)->setEnabled(enabled && (rdo_selection != 0)); + getChild<LLUICtrl>(SLD_DAYOFFSET)->setEnabled(enabled && (rdo_selection != 0)); getChild<LLUICtrl>(CHK_ALLOWOVERRIDE)->setEnabled(enabled && (mCurrentParcelId == INVALID_PARCEL_ID)); getChild<LLUICtrl>(BTN_APPLY)->setEnabled(enabled && (mDirtyFlag != 0)); getChild<LLUICtrl>(BTN_CANCEL)->setEnabled(enabled && (mDirtyFlag != 0)); @@ -259,19 +261,23 @@ void LLPanelEnvironmentInfo::setDirtyFlag(S32 flag) getChildView(BTN_CANCEL)->setEnabled((mDirtyFlag != 0) && can_edit); } +void LLPanelEnvironmentInfo::clearDirtyFlag(S32 flag) +{ + bool can_edit = canEdit(); + mDirtyFlag &= ~flag; + getChildView(BTN_APPLY)->setEnabled((mDirtyFlag != 0) && can_edit); + getChildView(BTN_CANCEL)->setEnabled((mDirtyFlag != 0) && can_edit); +} + void LLPanelEnvironmentInfo::onSwitchDefaultSelection() { + bool can_edit = canEdit(); setDirtyFlag(DIRTY_FLAG_DAYCYCLE); -// bool use_defaults = mRegionSettingsRadioGroup->getSelectedIndex() == 0; -// -// getChild<LLView>("edit_btn")->setEnabled(!use_defaults); -// -// mDayLengthSlider->setEnabled(!use_defaults); -// mDayOffsetSlider->setEnabled(!use_defaults); -// -// setDirty(true); -} + S32 rdo_selection = getChild<LLRadioGroup>(RDG_ENVIRONMENT_SELECT)->getSelectedIndex(); + getChild<LLUICtrl>(SLD_DAYLENGTH)->setEnabled(can_edit && (rdo_selection != 0)); + getChild<LLUICtrl>(SLD_DAYOFFSET)->setEnabled(can_edit && (rdo_selection != 0)); +} void LLPanelEnvironmentInfo::onSldDayLengthChanged(F32 value) { @@ -281,7 +287,6 @@ void LLPanelEnvironmentInfo::onSldDayLengthChanged(F32 value) setDirtyFlag(DIRTY_FLAG_DAYLENGTH); } - void LLPanelEnvironmentInfo::onSldDayOffsetChanged(F32 value) { F32Hours dayoffset(value); @@ -295,7 +300,7 @@ void LLPanelEnvironmentInfo::onSldDayOffsetChanged(F32 value) void LLPanelEnvironmentInfo::onBtnApply() { -// doApply(); + doApply(); } void LLPanelEnvironmentInfo::onBtnReset() @@ -323,6 +328,35 @@ void LLPanelEnvironmentInfo::onBtnSelect() } } + +void LLPanelEnvironmentInfo::doApply() +{ + if (getIsDirtyFlag(DIRTY_FLAG_MASK)) + { + S32 rdo_selection = getChild<LLRadioGroup>(RDG_ENVIRONMENT_SELECT)->getSelectedIndex(); + + if (rdo_selection == 0) + { + LLEnvironment::instance().resetParcel(mCurrentParcelId, + [this](S32 parcel_id, LLEnvironment::EnvironmentInfo::ptr_t envifo) {handleEnvironmentReceived(parcel_id, envifo); }); + } + else if (rdo_selection == 1) + { + LLEnvironment::instance().updateParcel(mCurrentParcelId, + mCurrentEnvironment->mDayCycle->getAssetId(), mCurrentEnvironment->mDayLength.value(), mCurrentEnvironment->mDayOffset.value(), + [this](S32 parcel_id, LLEnvironment::EnvironmentInfo::ptr_t envifo) {handleEnvironmentReceived(parcel_id, envifo); }); + } + else + { + LLEnvironment::instance().updateParcel(mCurrentParcelId, + mCurrentEnvironment->mDayCycle, mCurrentEnvironment->mDayLength.value(), mCurrentEnvironment->mDayOffset.value(), + [this](S32 parcel_id, LLEnvironment::EnvironmentInfo::ptr_t envifo) {handleEnvironmentReceived(parcel_id, envifo); }); + } + + } + setControlsEnabled(false); +} + void LLPanelEnvironmentInfo::onPickerCommited(LLUUID asset_id) { LLSettingsVOBase::getSettingsAsset(asset_id, [this](LLUUID, LLSettingsBase::ptr_t settings, S32 status, LLExtStat) { @@ -358,7 +392,7 @@ void LLPanelEnvironmentInfo::handleEnvironmentReceived(S32 parcel_id, LLEnvironm return; } mCurrentEnvironment = envifo; - setDirtyFlag(DIRTY_FLAG_DAYCYCLE); + clearDirtyFlag(DIRTY_FLAG_MASK); refresh(); } |