diff options
Diffstat (limited to 'indra/newview/llpanelenvironment.cpp')
-rw-r--r-- | indra/newview/llpanelenvironment.cpp | 69 |
1 files changed, 60 insertions, 9 deletions
diff --git a/indra/newview/llpanelenvironment.cpp b/indra/newview/llpanelenvironment.cpp index abd1913185..f84ceb6853 100644 --- a/indra/newview/llpanelenvironment.cpp +++ b/indra/newview/llpanelenvironment.cpp @@ -73,6 +73,7 @@ const std::string LLPanelEnvironmentInfo::SLD_DAYLENGTH("sld_day_length"); const std::string LLPanelEnvironmentInfo::SLD_DAYOFFSET("sld_day_offset"); const std::string LLPanelEnvironmentInfo::SLD_ALTITUDES("sld_altitudes"); const std::string LLPanelEnvironmentInfo::ICN_GROUND("icon_ground"); +const std::string LLPanelEnvironmentInfo::ICN_WATER("icon_water"); const std::string LLPanelEnvironmentInfo::CHK_ALLOWOVERRIDE("chk_allow_override"); const std::string LLPanelEnvironmentInfo::LBL_TIMEOFDAY("lbl_apparent_time"); const std::string LLPanelEnvironmentInfo::PNL_SETTINGS("pnl_environment_config"); @@ -107,6 +108,10 @@ const U32 LLPanelEnvironmentInfo::DIRTY_FLAG_MASK( const U32 ALTITUDE_SLIDER_COUNT = 3; const F32 ALTITUDE_DEFAULT_HEIGHT_STEP = 1000; +const U32 ALTITUDE_MARKERS_COUNT = 3; +const U32 ALTITUDE_PREFIXERS_COUNT = 5; + +const std::string slider_marker_base = "mark"; const std::string alt_sliders[] = { "sld1", @@ -175,7 +180,16 @@ BOOL LLPanelEnvironmentInfo::postBuild() mChangeMonitor = LLEnvironment::instance().setEnvironmentChanged([this](LLEnvironment::EnvSelection_t env, S32 version) { onEnvironmentChanged(env, version); }); - getChild<LLSettingsDropTarget>(SDT_DROP_TARGET)->setPanel(this); + for (U32 idx = 0; idx < ALTITUDE_SLIDER_COUNT; idx++) + { + LLSettingsDropTarget* drop_target = findChild<LLSettingsDropTarget>("sdt_" + alt_prefixes[idx]); + if (drop_target) + { + drop_target->setPanel(this, alt_sliders[idx]); + } + } + getChild<LLSettingsDropTarget>("sdt_" + alt_prefixes[3])->setPanel(this, alt_prefixes[3]); + getChild<LLSettingsDropTarget>("sdt_" + alt_prefixes[4])->setPanel(this, alt_prefixes[4]); return TRUE; } @@ -256,7 +270,7 @@ void LLPanelEnvironmentInfo::refresh() { sld->addSlider(altitudes[idx + 1], alt_sliders[idx]); updateAltLabel(alt_prefixes[idx], idx + 2, altitudes[idx + 1]); - mAltitudes[alt_sliders[idx]] = AltitudeData(idx+1, idx, altitudes[idx+1]); + mAltitudes[alt_sliders[idx]] = AltitudeData(idx+2, idx, altitudes[idx+1]); } if (sld->getCurNumSliders() != ALTITUDE_SLIDER_COUNT) { @@ -441,11 +455,29 @@ bool LLPanelEnvironmentInfo::setControlsEnabled(bool enabled) getChild<LLUICtrl>(SLD_DAYOFFSET)->setEnabled(can_enable && !is_legacy); getChild<LLUICtrl>(SLD_ALTITUDES)->setEnabled(can_enable && isRegion() && !is_legacy); getChild<LLUICtrl>(ICN_GROUND)->setColor((can_enable && isRegion() && !is_legacy) ? LLColor4::white : LLColor4::grey % 0.8f); + getChild<LLUICtrl>(ICN_WATER)->setColor((can_enable && isRegion() && !is_legacy) ? LLColor4::white : LLColor4::grey % 0.8f); getChild<LLUICtrl>(BTN_RST_ALTITUDES)->setEnabled(can_enable && isRegion() && !is_legacy); getChild<LLUICtrl>(PNL_ENVIRONMENT_ALTITUDES)->setEnabled(can_enable && isRegion() && !is_legacy); getChild<LLUICtrl>(CHK_ALLOWOVERRIDE)->setEnabled(can_enable && isRegion() && !is_legacy); - getChild<LLSettingsDropTarget>(SDT_DROP_TARGET)->setDndEnabled(enabled && !is_legacy); + for (U32 idx = 0; idx < ALTITUDE_MARKERS_COUNT; idx++) + { + LLUICtrl* marker = findChild<LLUICtrl>(slider_marker_base + llformat("%u", idx)); + if (marker) + { + static LLColor4 marker_color(0.75f, 0.75f, 0.75f, 1.f); + marker->setColor((can_enable && isRegion() && !is_legacy) ? marker_color : marker_color % 0.3f); + } + } + + for (U32 idx = 0; idx < ALTITUDE_PREFIXERS_COUNT; idx++) + { + LLSettingsDropTarget* drop_target = findChild<LLSettingsDropTarget>("sdt_" + alt_prefixes[idx]); + if (drop_target) + { + drop_target->setDndEnabled(enabled && !is_legacy); + } + } return true; } @@ -606,7 +638,7 @@ void LLPanelEnvironmentInfo::onAltSliderCallback(LLUICtrl *cntrl, const LLSD &da while (iter != end) { iter2 = mAltitudes.begin(); - new_index = 1; + new_index = 2; while (iter2 != end) { if (iter->second.mAltitude > iter2->second.mAltitude) @@ -615,9 +647,9 @@ void LLPanelEnvironmentInfo::onAltSliderCallback(LLUICtrl *cntrl, const LLSD &da } iter2++; } - iter->second.mAltitudeIndex = new_index; + iter->second.mTrackIndex = new_index; - updateAltLabel(alt_prefixes[iter->second.mLabelIndex], iter->second.mAltitudeIndex + 1, iter->second.mAltitude); + updateAltLabel(alt_prefixes[iter->second.mLabelIndex], iter->second.mTrackIndex, iter->second.mAltitude); iter++; } @@ -756,7 +788,24 @@ void LLPanelEnvironmentInfo::onIdlePlay(void *data) ((LLPanelEnvironmentInfo *)data)->udpateApparentTimeOfDay(); } -void LLPanelEnvironmentInfo::onPickerCommitted(LLUUID item_id) + +void LLPanelEnvironmentInfo::onPickerCommitted(LLUUID item_id, std::string source) +{ + if (source == alt_prefixes[4]) + { + onPickerCommitted(item_id, 0); + } + else if (source == alt_prefixes[3]) + { + onPickerCommitted(item_id, 1); + } + else + { + onPickerCommitted(item_id, mAltitudes[source].mTrackIndex); + } +} + +void LLPanelEnvironmentInfo::onPickerCommitted(LLUUID item_id, S32 track_num) { LLInventoryItem *itemp = gInventory.getItem(item_id); if (itemp) @@ -764,7 +813,8 @@ void LLPanelEnvironmentInfo::onPickerCommitted(LLUUID item_id) LLHandle<LLPanel> that_h = getHandle(); LLEnvironment::instance().updateParcel(getParcelId(), itemp->getAssetUUID(), - itemp->getName(), + itemp->getName(), + track_num, -1, -1, LLEnvironment::altitudes_vect_t(), [that_h](S32 parcel_id, LLEnvironment::EnvironmentInfo::ptr_t envifo) { _onEnvironmentReceived(that_h, parcel_id, envifo); }); } @@ -931,7 +981,8 @@ BOOL LLSettingsDropTarget::handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop, *accept = ACCEPT_YES_COPY_SINGLE; if (drop) { - mEnvironmentInfoPanel->onPickerCommitted(item_id); + // might be better to use name of the element + mEnvironmentInfoPanel->onPickerCommitted(item_id, mTrack); } } } |